I am using 21.2
When i filter rows and select Is Null, it doesnt return any rows. I think it is due
to the underlying bounddatafield is blank, not null.
I would like to give users ability to filter rows with blank values, so I can either
add a new filter type or change behaviour of existing is null filter.
Im not sure how to do this ?
thanks in advance
There is no way to override the Filtering behavior of the predefined options. Additionally, when you use the “Equals” filter rule option with an empty string value, it acts like the "Clear Filter" rule, which is by design.
The only way to make the “isNull” filter rule to show the empty values in the field would be to handle the DataFiltering event on the server and filter the data source on your own and rebind it back to the grid. You would also need to consider a few other cases such as being able to filter the original data of the grid, while using the other filter rules such as “Equals”, “Contains” etc. to do this you would have to check if the filter rule is different from is null and rebind the original data.
To be able to use the “Clear Filter” when using the “isNull” filter rule, another filter rule should be assigned so that the column contains a filter condition that could be cleared by using “Clear Filter”, if the column doesn’t contain null values, then “isNotNull” might be the appropriate filter rule.
Please note that all those scenarios need to be handled on application level and depending on the needs of your application some other cases would need to be considered as well.
I am attaching a small sample that demonstrates what I have explained above, please test it and let me know if you have any questions or concerns.
Regards, Ivan Kitanov
unfortunately this did not work. all of the rows are still showing up.
Rather than altering the behaviour of isnull, maybe i should hide it and add a new one ?
not sure how to do this though
I got this working by adjusting the values when retrieving data. If empty string, then set to null.
Still, it would be nice to know how to setup a 'custom' condition that dealt with blanks
The grid does not have such functionality that would allow you to change the functionality of the igg_FilterRuleDropDownItem. You can change their inner text, for example “Is Null” could be changed to “Empty values”. Below you can find a forum post that demonstrates how this could be done:
Even though the text for the filter rule options could be changed the only way of changing their behavior/functionality is through the DataFiltering event of the grid and this was the reason why I suggested you using the DataFiltering event.
Have you got the chance to try out the sample I sent in my previous reply and if you did could you please share a code snipped of your own code so I try to investigate what might be the issue?
Additionally, if you could share a small sample that demonstrates the issue, it would be ideal.
Looking forward to hearing from you.