Est-il possible d'empêcher la sélection et / ou la mise en évidence de JQGrid d'être sélectionnés et / ou mis en évidence?

StackOverflow https://stackoverflow.com/questions/2148135

Question

J'ai regardé le Documentation Mais je n'ai pas pu trouver de réponse. Existe-t-il un moyen d'empêcher la mise en évidence d'une ligne lorsqu'il est sélectionné? Cela ou même un moyen d'empêcher la ligne de sélectionner du tout. J'aime l'option "hoverrows: true", mais idéalement je voudrais empêcher une ligne d'être sélectionnée en clic.

Merci,

Mise à jour:J'ai été en mesure d'implémenter "Hackily" quelque chose qui semble être une correction provisoire. Je n'aime pas du tout ça et je voudrais une meilleure solution, s'il y en a un ...

J'ai trouvé que si je passe l'option

onSelectRow: function(rowid, status) {
    $('#'+rowid).removeClass('ui-state-highlight');
}

Lorsque j'installer le jqgrid, je peux dépouiller le point culminant lorsqu'il est ajouté.

Y a-t-il une autre façon plus idéale de faire cela?

Était-ce utile?

La solution

Utilisez le code suivant:

beforeSelectRow: function(rowid, e) {
    return false;
}

Autres conseils

If you, like me, have a gazillion jqGrids and don't want to override onSelectRow for every single one, here's a global version of Reigel's solution that worked nicely for me:

jQuery.extend(jQuery.jgrid.defaults, {
    onSelectRow: function(rowid, e) {
        $('#'+rowid).parents('table').resetSelection();
    }
});

I suppose you could address this in the CSS directly. Just override the values for ui-state-highlight for your specific table

#table_id tr.ui-state-highlight {
  border: inherit !important;
  background: inherit !important;
  color: inherit !important;
}

#table_id tr.ui-state-highlight a {
  color: inherit !important;
}

#table_id tr.ui-state-highlight .ui-icon {
  background-image: inherit !important;
}

I used the value inherit just as an example - you will likely need to copy some values from your theme.css to make this work.

try:

onSelectRow: function(rowid, status) {
    $("#grid_id").resetSelection(); //Resets (unselects) the selected row(s). Also works in multiselect mode.
}

you can read documentations here. Hope it helps you...

Yes, use the rowattr callback:

rowattr: function (rowData,currentObj,rowId) {
    if (rowData.SomeField=="SomeValue") { 
        return {"class": "ui-state-disabled"};
    }
},

This also grays out the row and disables the selection.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top