问题
I want to fix some columns so that user cannot drag and drop these columns and cannot reorder these columns also.Is it doable how can i do it.
回答1:
There is code inside grid.jqueryui.js that uses the jQuery UI Sortable Interaction to enable drag-and-drop columns.
The following selector determines which columns can be dragged-and-dropped:
"items": '>th:not(:has(#jqgh_'+tid+'_cb'+',#jqgh_'+tid+'_rn'+',#jqgh_'+tid+'_subgrid),:hidden)',
So basically the selector will choose any column header that is not hidden and does not satisfy one of the following criteria:
#jqgh_'+tid+'_cb'
- A checkbox column (for multi-select)#jqgh_'+tid+'_rn'
- A row number column (for primary key?)#jqgh_'+tid+'_subgrid
- A subgrid column
To satisfy your request, jqGrid would have to be modified to populate the items
selector with blacklisted columns. Maybe the blacklisted columns could be flagged using a new colmodel
option. This is all do-able, but requires changes to jqGrid itself...
来源:https://stackoverflow.com/questions/9578273/want-to-fix-some-columns