Is it possible to Stop jqGrid row(s) from being selected and/or highlighted?

十年热恋 提交于 2019-12-03 02:30:09

Use the following code:

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

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!