How can I display any applied filter criteria on the Kendo UI Grid. I would like to have a readonly display, of the applied criteria. Current functionality does allow user to apply filter, but that the user has to go to the filter menu to look for the filter details.
相关问题
- Foreign key column sorting
- Kendo UI bind drop down value from PopupEditor
- Kendo mvc grid InLine Edit Mode DateTimePicker Tem
- How to change color of row based on particular col
- Kendo UI for MVC Grid How do I hide the ID column
相关文章
- Kendo Ui Dropdownlist Set Visible via Javascript
- How to change view date dynamically (which is filt
- Kendo DropDownList Shows DataValueField Prior to D
- Kendo UI Datasource - Filter on releated data
- Kendo UI Grid Refesh on Dropdown Selection
- How to bind kendo mvc ui dropdownlist dynamically
- KendoUI integration into Durandal JS
- How to make a Pie Chart Aggregate the Data Source?
The Kendo UI data source doesn't have a filter event, so you'd need to implement that yourself. Then when the event is triggered, you can get the current filter and format it in whatever way you want it displayed.
For example:
See demo here.
Note that filters can be nested, so once that happens, this example code won't be enough - you'll have to make the code that converts the filters to HTML recursive.
In order to augment all data sources with the "afterfilter" event, you have to change the DataSource protototype instead of changing it on your instance:
If you want to integrate the whole thing into all grid widgets, you could create a new method
filtersToHtml
which gets you the HTML represenatation and add it tokendo.data.DataSource.fn
like demonstrated above (or you could create your own widget derived from Kendo's grid); in the same way you could add a methoddisplayFilters
tokendo.ui.Grid.fn
(the grid prototype) which displays this HTML representation in a DOM element whose selector you could pass in with the options to your widget (you could ultimately also create this element within the grid widget). Then instead of triggering "afterfilter" in the filter method, you could calldisplayFilters
instead.Considering the complexity of the complete implementation which always displays filters, I'd suggest extending the Kendo grid instead of simply modifying the original code. This will help keep this more maintainable and gives it a bit of structure.
how about combining two filters of grid. this way the user can see the selected filter in text box and even remove it by hitting the 'x' button on filtered column text box.
you can do this by setting grid filterable like this
the documentation and example is in here