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.
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:
Let me know if I may be of further assistance.
Best Regards, Martin Evtimov Entry Level Software Developer Infragistics, Inc.
Hi,
I am not able to do that. I need to sort only one column from the entire table based on its NAME and not on its ID.
Following is the data -
------------------------------------------------
Can you help with the code or sample file? I have attached a file with this.dropdown.zip
Thanks for your reply!
Attached you will find a sample project where a custom sorting function is implemented only for the column with key “CatagoryID” so that the records in this column would be sorted based on their names and not IDs . As you can observe the built-in sorting is applied on the rest of the columns.
Please let me know if you need any further information.
Best Regards,Martin EvtimovEntry Level Software DeveloperInfragistics, Inc.
dropdown1.zip
Hello Martin,
Solution is working in case of sorting by clicking on column header but the same is not working in case of multisort via pop up window.
Regards,
Tapas
In case multisort is required I suggest modifying the structure of the dataSource and using the mapper function. Attached you’ll find a sample which implements the suggested modifications.
Please let me know if you need any further assistance.
dropdownMapper.zip