jqGrid: set column property dynamically - jqgrid

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

Related

slick grid - unheck all rows for paging, sorting and search events

I am using SlickGrid with the checkbox selector plugin and the pagination plugin. I want to only allow the user to select rows for the current page. I noticed that slickgrid remembers values that the user selects on a previous page. Only when a user selects a row on the current page does it uncheck the rows on a previous page. Is it possible to uncheck all rows on a page change event.
Similarly if the user does a search I want to unselect all rows.
Same with sorting, unselect all rows for the grid when the user does a sort.
Is it possible to do this?
The checkbox selector plugin was not designed for pager. Whenever you set checkbox as selected using the plugin, it remembers the row indices _selectedRowsLookup of the grid and re-apply the formatting when the grid invalidates. Thus, it will be the same rows check/unchecked on each page.
To achieve what you want, you have to customize the plugin where you need to:
Add a flag/field isSelected to your dataset that store if a record is selected
Set the formatter to check the dataContext.isSelected instead of using the _selectedRowsLookup
Change the handleSelectedRowsChanged to modify the field isSelected to true or false with the correct reference on the current page.
To select the rows of current page, change handleHeaderClick to only modify the rows displayed using the current pagingInfo
To clear the selection, reset the isSelected field to false and invalidate the grid rows.

Column header shows arrow icon after sortable is false in ExtJs grid

I have an ExtJs GridPanel in which sortable is false in all the columns.
Then if I sort store by
this.store.sort('Column1','ASC');
then the arrow reappers .
Does sortable gets true?
Is this because I am sorting the store or anything else?
If it the reason different than that then what is the solution for removing the arrow?
I would appreciate any help on this.
The arrow is being shown because of the sorter in the store, which identifies a column in the grid which has the dataIndex equal to the property you are sorting, despite the sorting being disable on this column. In this case, you could override the getSortParam function in your column definition, like this:
getSortParam: Ext.emptyFn
And your column will no longer show the arrow in the header.

Show hidden data with mouseover in a particular colum of Jqgrid

how can display items of a hidden colmodel when mouse over another column which shows only some part of the data. in user column i have many names, i only display first user name and rest the count. so i passed the full names as hidden. I want to display that names according to the mouseover
If I correctly understand the problem you can solve it by usage cellattr callback which defines title attribute based on the value of another (hidden) column. See the answer for the corresponding code example.

Hide Column, but display its filter, in Kendo Grid

I am looking to create a bunch of filters on a Kendo Grid but these filters are for hidden columns.
I want to display the filter (perhaps moving it outside the grid area with jQuery) but keep the entire column hidden.
Any suggestions?
Use the dataSource.filter method for that implementation.
$('#GridName').data().kendoGrid.dataSource.filter({field:"hiddenColumnName",operator:"gt",value:42});
If for some reason you want to extract these filter descriptors from the Grid you can use the filter method without parameters. An object will be returned which will contain how exactly the Grid is filtered.
Please notice that this approach does not even require to have the columns hidden (you can skip declaring them at all). The whole objects (with all fields) are available by default on the client.

Make only certain columns editable in SlickGrid

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.

Resources