Current filter:
                                You should refresh the page.
                                  • Here is my CodePen to demonstrate my case:https://codepen.io/ThanhVan/pen/mdbVxqK

                                    In detail,
                                    If I set up the filter

                                    - With 'contains' :  ["Category", "contains", 4] then It will return 2 records for SupperPlasma 50 and SuperLED50:

                                    But
                                    . With 'equals' :  ["Category", "=", 4] then It will return only one record for SuperLED50 .

                                    How can I make it return the same value for the array field??

                                1 Solution

                                Creation Date Importance Sort by

                                Hi,

                                In this scenario, you need to define the "Category" field's calculateFilterExpression callback function to handle filtering for your custom data format. For example:

                                [JavaScript]
                                calculateFilterExpression: function(value, operation, target) { return [data => data.Category.indexOf(value) >= 0, "=", operation !== "<>"] },

                                Here is the modified code example: https://codepen.io/vconst/pen/wvwobvO.

                                Thanks,
                                Alessandro

                                • Thanh Van 2 08.15.2019

                                  Thanks for replying, But look like you don't give me the solution for it?

                                  1st, Why did this behavior support in DevExpress? Do you mean If I use a string then it will work with both cases?

                                  2nd, I think you didn't look closely at my CodePen. Category filter set-up in Filter Builder just uses lookup data source with displayExpr and ValueExpr as the control provided not complex, and the value output is a number, NOT an object.

                                  Finally, Very hard to convert all Old DevExpress filter strings ( desktop app and web app) to DevExtreme filter strings and keep the same query results.

                                • Thanh Van 2 08.15.2019

                                  I updated the CodePen as you said about String but the result worse than using numbers. Before I can use "equals" to get the value for Category:["Automation"] but now, It returned NOTHING.

                                • Alessandro (DevExpress Support) 08.16.2019

                                  Hi,

                                  We need some more time to research the issue. We will inform you about our progress once we have any results. Please accept our apologies for the delay that may arise.

                                • Alessandro (DevExpress Support) 08.22.2019

                                  Hi,

                                  Thank you for your patience. We have finished our research and updated the original answer. Should you need further clarification, feel free to ask. I will be happy to help you.