Hello.I believe I've found a bug when trying to apply column filters programaticly.In my project I'm using a grid with excel style filtering on various columns. When applying a new filter, I'm using the onFilteringDone event which returns an object of IFilteringExpressionsTree which I'm saving for later.When the time comes to apply the saved filters to the grid im using the filter() method on the IgxGridComponent object.The filter() method takes, as it's third parameter, an object of either IFilteringOperation or IFilteringExpressionsTree.
However. If i use the IFilteringExpressionsTree object that i saved. I get the error: "cond.logic is not a function".
Upon debugging I've found that it is the object of IFilteringExpressionsTree which is represented as "cond". But the object has no function called 'logic'. That method exists in the other object type (IFilteringOperation). This is probably an oversight. I'm currently using Infragistics 13.Has this bug been fixed in Infragistics 14?Is there another solution that I've overlooked perhaps?
Hello Nebojsa,
I have been looking into your question and I tested the described scenarios with the supported versions of Ignite UI Angular 13.2, 14.x and everything worked as expected. The error "cond.logic is not a function" appears when the required object is not passed as the third parameter of the filter() method. That's why the only time I was able to reproduce the problem was when in the filteringDone event I took the filteringOperands property of the event, not the event itself, and then passed that object as the third parameter to the filter() method. Make sure you don't get a property from the filteringDone event, but the whole event since it is of type IFilteringExpressionsTree and that type of object is passed to the filter() method.
Since the exact custom logic behind the application is not described, I created a small sample in which I first apply excel filtering on a given column. In the filteringDone event, I save the field, the search value, and the event itself as an IFilteringExpressionsTree object. Then to apply the filtering pragmatically after some time I reset the grid filters with clearFilter() method and make sure I don't take the given properties again because filteringDone will fire again on reset(clearFilter) and the event will have an undefined property. Then I filter the grid with the filter() method and pass the saved values as parameters to it. You can observe the steps and the result here:
In addition, you can find the sample illustrating my suggestion here. Please test it on your side and let me know how it behaves. If this is not an accurate demonstration of what you are trying to achieve, please feel free to modify it and send it back to me along with steps to reproduce. Alternatively, if the behavior cannot be replicated, please feel free to provide your own sample.
If you require any further assistance on the matter, please let me know.
Regards,
Georgi Anastasov
Entry Level Software Developer
Infragistics
Hello!Sorry for the late answer. I've been researching the differences between our code to be able to further understand what the underlying issue is.What i failed to mention first time around was that I'm converting the event object to json to be able to store it in sessionStorage for later. At the time, I didn't believe it to be very relevant to the issue.However, it turned out to be the main cause. I failed to realise that the object contains methods in multiple places which cannot be serialized to Json.Trying to convert these methods to strings and back did not work well at all so I've abandoned this solution in favor of another one.I thank you very much for your quick response.Best regards!
Hello,I'm glad if I could help you find a solution.
Thank you for using Infragistics components!
Best regards,