I am not using remote sorting, Using local sorting & columnSorted event, I would like to retrieve custom sorted data and assign to the grid, I am able to achieve most of the requirements except to show correct icon next to column title (down arrow or uparrow), is there any way to achieve this?
Thanks
Hi annasaheb,
Thank you for sharing your code with the community.
Let me know if you have further questions.
Thanks, I had to write a code to get the table header and assign class to correct span. here is a code, may be useful for other coders.
// set sortField & sortOrderDesc before calling this routine.
$("#dataGrid").data("igGrid").headersTable().find("thead tr th").each(function() { if (this.id.indexOf(sortField) != -1) { var sortClass = (sortOrderDesc) ? "ui-iggrid-colindicator-desc ui-icon ui-icon-arrowthick-1-s" : "ui-iggrid-colindicator-asc ui-icon ui-icon-arrowthick-1-n" $(this).find(".ui-iggrid-colindicator").addClass(sortClass); } }).end();
The sorting indicator icons are placed inside of a span in the grid headers. You could apply the following css classes to this span: .ui-icon and .ui-icon-arrowthick-1-s (for down arrow) or .ui-icon-arrowthick-1-n (for up arrow). Here you can find a sample of igGrid local sorting - https://www.igniteui.com/grid/sorting-local.
Hope this helps.