jqGrid Seleccionar varias filas

Is it possible that a user clicks on a row in the jqGrid and it triggers off onSelectRow which is normal behavior. Also I need the functionality if a user uses "Control + click" then it marks the row as selected (for print& excel export) but does not trigger onSelectRow.

preguntado el 01 de febrero de 12 a las 14:02

@Oleg you may be able to help me on this... -

If you want to post me a message you should write comment to any my respuesta anterior (consulte aquí for details). The usage of "@Oleg" on the page where no answer or comment from me exist can't be resolved. If you search for the name Oleg you will find many users with the alias. -

1 Respuestas

If you just want to highlight some rows to create a screenshot, for the demonstration purpose or for printing you can use beforeSelectRow to implement the behaviour which you need:

beforeSelectRow: function (rowid, e) {
    var $tr;
    if (e.ctrlKey) {
        $tr = $(e.target).closest('tr.jqgrow');
        if ($tr.hasClass("ui-state-highlight")) {
        } else {
        return false;
    return true;

Consulte nuestra página la demo:

enter image description here

I should mention, that in the demo I used additionally disableSelection method used internally by jQuery UI to prevent selection of the texts in the grid.

Respondido el 02 de enero de 13 a las 09:01

+1 Code can be simplified by removing the if ($tr.hasClass("ui-state-highlight")) block and replacing with $tr.toggleClass("ui-state-highlight"); - Lee Taylor

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.