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.
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...
Related
I'm using kendo grid. One of the requirements is that the data of the hidden columns will be fetched only when the column becomes visible.
I want to use default column seletion (in the column menu), so when the checkbox of column is checked I want to catch it and go to the server to get relevant data and show the column only after the data arrives (or maybe even to rebuild the grid, whatever is possible). I can't find how to catch this click event and prevent default behavior?
I am adding a new column to SlickGrid using of course grid.setColumns(newColumnDef);
I allow the user to then enter values into this new column
If they so choose they can remove this column and add another column which they can select from a dropdown list.
This all works fine, the column gets removed and the grid appears without the removed column. However when I call dataView.getItems() to grab the data from the grid the columns I'vd previously removed are still there. Looks like setColumns with a new column definition and dataView.refresh does not delete the columns data, just the column is removed. I need to remove the columns data when the column is removed... Any suggestions would be most helpful.
Changing the presentation of the data does not change the data itself.
Use deleteItem method of dataview as follows,
dataView.deleteItem(id);\\where id is your unique id
dataView.refresh();`
jqgrid doc in here contains:
method allow to reorder the grid columns using the mouse. The only necessary setting in this case is to set the sortable option in jqGrid to true.
I have sortable: true but columns cannot reordered by dragging headers by mouse. How to re-order columns by dragging columns headers or other way without using column chooser ?
To implement sortable columns is really easy. You should just follow the documentation. You should just
include jquery-ui.min.js additionally to jquery-ui.css which are always required. The most people have the file already included because of usage jQuery UI Widgets like Datepicker, Autocomplete, Tabs and so on.
add sortable: true option to the grid.
Now you can already (see the demo) drag the column header and drop it on another position.
I need to show/hide columns in jqGrid and to filter grid results.
For hiding and showing I use global array on the page. It keeps state.
For searching and filtering I use build-in filter dialog.
For invisible columns I set property "search" for "false"(nobody wants to sort results if he doesn't see it) so...there is no such column in the filter list. But when I show any column that was hidden(I call $("#jqgrid").showCol(colName);) then this column doesn't appear in the filter list. Of course, I have to change column's "search" property. But how??? Is it possible?
Thanks in advance
I have a grid with multiple columns and I use the first column for a row label. I looked at the example for making the grid editable, but that appears to make the whole grid editable. Is there away to specify a certain column(s) only?
Got it! By not setting the editor property on the column object the column is non-editable.