jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Apply Excel filter to empty fields
Tagged: grid excel filtermode
This topic contains 11 replies, has 2 voices, and was last updated by Hristo 4 years, 4 months ago.
-
Author
-
Hello,
I ran into an issue when using the Excel filtermode when the cell values are either non-existent or null.Json data is read from a mongo db, and data for certain fields (columns) may not be part of the json. The data is presented fine in the JqxGrid – shown correctly as an empty cell. This is also true for columns defined as both INT and FLOAT.
The issue occurs when you select the excel dropdown. It will display a checkbox with a “blank/null” item. If you choose this (e.g. I want to see all cells w/no value) it either filters out EVERYTHING or, in the case of numbers, it will crash with “Cannot read property ‘indexOf’ of null”
I understand the excel filter is doing exact match on cell using ‘==’ but it seems to fail on null or non-existent values. How do we handle this?
I have provided fiddle here that shows exact problem. http://jsfiddle.net/rfossella/8gq2t7es/4/
Rob
—
Also, another question about this: if the match is done based on the underlying cell value vs. the rendered value how do we handle this when a cell is rendered based on the value of another cell in the row?
e.g.
cellA = 2
cellB = (if cellA == 0 ? “N/A” : “VALID”Hello Rob,
I would like to suggest you use the
filteritems
member for the column with the “null” value.
Please, take a look at this example.
About the second question, I would like to suggest you use the sixth parameter of thecellsrenderer
callback.
It provides information for the whole row as a JSON object.Best Regards,
Hristo HristovjQWidgets team
https://www.jqwidgets.comHello Hristo,
I’m not sure if you followed my question. It seems like you’re telling me to not use the excel filter?
As shown in the jsfiddle, the items displayed in dropdown are not being reflected when I select them.
Did you review the jsfiddle and see the error that shows up in the console?Please review and please clarify your answer.
Thanks
RobHello Rob,
Unfortunately, there is no
virtualmode
feature for scrolling for the jqxTreeGrid.
The only possible option is to load records on demand for the newly expanded item.
On the other hand, you could use our Smart.Grid with the Tree Grid mode.
Please, take a look at this demo:
https://www.htmlelements.com/demos/grid/virtual-tree-grid/
It is also part of our products – the Smart HTML Elements library.Best Regards,
Hristo HristovjQWidgets team
https://www.jqwidgets.comHello Rob,
Thank you for your example and your patience.
Sorry for the previous message it is part of another answer.
About your case, I would like to suggest an approach where you could add the values by which you want to filter.
Please, take a look at this example:
http://jsfiddle.net/txhi/kmxbj7ce/
Another option is to create a custom filter menu (but for all columns), please, take a look at this demo.
There you could add desired values and filtering by the wanted way.Best Regards,
Hristo HristovjQWidgets team
https://www.jqwidgets.comHello Hristo
I see your example for setting filteritems with hard-coded array. How would I do this for dynamic array? In other words, I want filteritems (for numbers) to be all possible values within that column except those that may are NaN.Want something dynamic here:
filteritems: () =>{return [“100”, “200”]}Thanks
RobHristo – also please note in your example with hard-coded values, behavior is odd when doing a SELECT ALL vs. SELECT NONE with blanks showing up.
Hello Rob,
Thank you for the feedback and patience.
I will create a work item for this and probably in the next version will be fixed.Best Regards,
Hristo HristovjQWidgets team
https://www.jqwidgets.comThank you. I look forward to the fix.
Hello. Has any progress been made with this fix?
Hello Rob,
I check for this and I did not find a work item that should be resolved.
Also, I tested the examples above, and it seems to work fine.
Could you check on your side?
Maybe I miss something.Best Regards,
Hristo HristovjQWidgets team
https://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.