11 Answers, 1 is accepted
If I understand you correctly you would like to customize the filter menu in the Kendo UI Grid. If this is the case then I suggest you to check the following demo that shows how to create separate filter for each column:
In case you have any further questions, then please open a separate support request with some more detailed information and we will be happy to help.
. This gives me two set of filters on column Name. First filter (Starts with) AND/OR second filter (Starts with) (name starts with a AND starts with b) here I want only one set of filter. This can be archived by making .Extra(False). Good so far. But the problem is when on the same grid I put filter on the date column. .Extra(false) will also take away second set of filter from the date column where as in date column I want two set of filter to select the date range (Date after .... and... date Before ...)
.Filterable(filterable => filterable
.Operators(operators => operators
.ForString(str => str.Clear()
.IsEqualTo("Is equal to")
.IsNotEqualTo("Is not equal to")
.DataSource(dataSource => dataSource
.Read(read => read.Action("Shipment_Read_nw", "Home")))
You can use the filterMenuInit event, where you can detect the column field for the date column and manipulate the filters there. Like for example:
If this does not resolve the issue, then please edit the provided example in order for us to better understand the problem.
For your date example at:
If you leave the first date textbox empty, fill in a date in the second textbox, and click the Filter button, it works as expected, showing all items before the specified date. But if you open the Filter popup again, it puts the date you entered into the FIRST textbox instead of into the second one. Is there a way to fix this?
This would not be possible with the built-in filter, as it just applies the existing expression and in the case that you describe, the expression is "BirthDate is less than someValue".
You can achieve your requirement by creating custom content for the filter menu in the filterMenuInit event. One possible way is shown in the following Dojo:
I think there is a bug in the following Dojo which you've shared:
I attached a screenshot pictures which describes the problem. If you follow the steps in that file, you will encounter a problem at the last step.
When i want to get some data before a specific date, the all data disappears. Then, if i click the filter button again, the date that i entered shifted up.
I think the filter operator applies some default procedure when extra filter area (second date filter having "lte" operator) is applied.
How can we overcome this issue?
Thanks in advance.
The Dojo uses random generated data so it is not possible to reproduce the described behaviour. I have added some hard coded data and used the steps you provided in an attempt to reproduce it but it seems to work well. Perhaps because the example does not have a Filter button:
Having said that, the behaviour is expected when using the built-in menu because it loops the filter array to populate its options. If filter is no longer available, it would move filter up as it does in the built in filterable option:
Can you check the provided updated example and let me know if you can reproduce it there and with what steps?
this solution works fine. Thanks a lot!