So I've been working a lot with the Kendo Grid lately. I've been able to get Server side filtering, sorting and virtual paging working in MVC. Now that I've found that out I want to be able to update the columns of the grid when I'm filtering data.
For example I have a grid which will list a set of people. I have the ability to filter those people by sub sets such as workers, farmers, or managers. Each of these filters would cause me to want to display different column information which is more pertinent to the subset I'm filtered on.
I've tried a few things:
1. Breaking the parameter for a grid's columns out into a separate variable (similar to how you would with a data source). This will work when the page loads, but my postback with the filters will not refresh the column list in the grid.
2. I've tried making a function that will look at what changed and pass a new array of columns, that doesn't work either
3. I've tried calling $("#MyGrid").empty(); and then re-building the object. This works about 1 of 3 times or less...I'm not quite sure what occurs as I'm getting errors from the minified web ui javascript. The errors I've gotten are:
- d.dataSource.group() is undefined
- f is not a function
I'm looking for any way in which I can refresh the column list with new data. Or a way in which I can display this information without making multiple grids which I would have to then show or hide.
EDIT: I want it to be known that I'm not trying to show/hide columns (as I know that is currently in feature request) but I'm looking instead to refresh the column collection used on the current grid.
For example I have a grid which will list a set of people. I have the ability to filter those people by sub sets such as workers, farmers, or managers. Each of these filters would cause me to want to display different column information which is more pertinent to the subset I'm filtered on.
I've tried a few things:
1. Breaking the parameter for a grid's columns out into a separate variable (similar to how you would with a data source). This will work when the page loads, but my postback with the filters will not refresh the column list in the grid.
2. I've tried making a function that will look at what changed and pass a new array of columns, that doesn't work either
3. I've tried calling $("#MyGrid").empty(); and then re-building the object. This works about 1 of 3 times or less...I'm not quite sure what occurs as I'm getting errors from the minified web ui javascript. The errors I've gotten are:
- d.dataSource.group() is undefined
- f is not a function
I'm looking for any way in which I can refresh the column list with new data. Or a way in which I can display this information without making multiple grids which I would have to then show or hide.
EDIT: I want it to be known that I'm not trying to show/hide columns (as I know that is currently in feature request) but I'm looking instead to refresh the column collection used on the current grid.