Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
450
Sorting and filtering not working based on NAME in igGrid combobox and working based only ID
posted

Hi Team,

In grid, we do have one column which is a dropdown/comboBox and sorting feature to be enabled for that column.

This is the data for dropdown –

northWindCategoriesJSON = [

                { "ID": 0, "Name": "Food" },

                { "ID": 1, "Name": "Beverages" },

                { "ID": 2, "Name": "Electronics" }

            ];

And when we apply sorting, values are sorted by ID (default behavior). But our requirement is we need to sort data based on “Name” in dropdown values.

How can we achieve this? I am attaching a sample file for reference.

Parents
No Data
Reply
  • 480
    Offline posted

    Hello Tapas,

    Thank you for contacting Infragistics Support!

    I assume that a Column Formatter is applied on the column with the dropdowns in order to display names instead of ids. If this is the case the described scenario is actually the expected behavior. As stated in our Column Formatting topic column formatting defines how column cell values are displayed in the grid. Formatting operates at the grid rendering phase and doesn't affect the data in the underlying data source. This means that features that operate on the data like Sorting, Filtering, Group By will not consider the formatted cell values. In order to sort by Name instead of ID I suggest the following approaches:

    • Sort the names in ascending order according to the ids in the dropdown data.
    • If not possible, following the Sorting topic you can create your own customSortFunction and implement your own logic in order to achieve the desired behavior.

    Let me know if I may be of further assistance.

    Best Regards,
    Martin Evtimov
    Entry Level Software Developer
    Infragistics, Inc.

Children