jQWidgets Forums
jQuery UI Widgets › Forums › Angular › Dynamically Adding a Filter Produces Error
This topic contains 1 reply, has 2 voices, and was last updated by ivanpeevski 2 years, 9 months ago.
-
Author
-
Good afternoon,
There are times that I need to programmatically apply a filter to several grids on several bootstrap tabs based on the user workflow. The grids may reside on tabs that may be collapsed (not yet displayed/expanded). If the angular code tries to add a filter to a grid (addfilter) on a collapsed tab, prior to the grid being displayed, the grid throws an error (from the console, see below) but if addfilter is called after the grid has been displayed no error occurs:
Cannot set properties of null (setting ‘filter’)
message.service.ts:67 Message Service: Cannot set properties of null (setting ‘filter’) null
message.service.ts:68 Message Service: TypeError: Cannot set properties of null (setting ‘filter’)
at c.<computed>.addfilter (http://localhost:59717/vendor.js:66024:16)
at push.34927.b.jqx.invoke (http://localhost:59717/vendor.js:27423:19)
at push.34927.b.jqx.jqxWidgetProxy (http://localhost:59717/vendor.js:27849:20)
at HTMLDivElement.<anonymous> (http://localhost:59717/vendor.js:28274:25)
at Function.each (http://localhost:59717/scripts.js:2:3003)
at S.fn.init.each (http://localhost:59717/scripts.js:2:1481)
at b.fn.<computed> [as jqxGrid] (http://localhost:59717/vendor.js:28273:14)
at jqxGridComponent.addfilter (http://localhost:59717/vendor.js:233307:17)This indicates that the addfilter is relying on the fact that the grid is currently displayed rather than simply storing the filters for when it is displayed, even though the grid has been programmatically instantiated in the angular code. This seems inconsistent with the fact that I can setup the grid with a datasource, data and call other functions on the grid like begin/endupdate and even applyfilters, but not addfilter. This leads me to conclude that this is a bug.
Would you please confirm this as functionality intended or as a bug?
Thanks
ChuckHi Chuck,
Thank you for contacting us!
This is indeed the expected behavior. The filters shouldn’t be set until after the grid has been initialized.
You can have a look at our Initial Filter demo. The initial filters are set in the ready callback function.I hope this was of help, if you have any other questions, please do not hesitate to contact us again.
Best regards,
Ivan Peevski
jQWidgets Team
https://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.