SitePen / dgrid

A lightweight, mobile-ready, data-driven, modular grid widget designed for use with dstore
http://dgrid.io/
Other
628 stars 295 forks source link

Custom Sorting on Grid with 2 opened tabs #1403

Closed 07shawk closed 4 years ago

07shawk commented 6 years ago

I was able to successfully create a custom sort for my grids. However, the issue I'm having right now is the location of the sort arrow appearing in the wrong grid.

For instance, I have two tabs opened and I sort on a column in tab 1 with a custom sort and then move to the 2nd tab and sort on the same column name from the 2nd tab. Everything sorts properly. However, when I go back to tab 1 and sort on the column again the column sorts but now to sort arrows appear in tab 2. Is there a way to remove the event from the sort and created a new event? If I remove the event as explained in the DOJO API, the sort will no longer work.

I've also tried putting the events in an array but it did not work.

Code for custom sort:

grid.on('dgrid-sort', function(e){ customSort.grid(e, grid); }

customSort.js grid: function(e, grid){ var sort = e.sort[0];

if (sort.property === "flag"){ e.preventDefault(); var sortAttributes = [{property: "flag", descending: sort.descending}, { property: "otherFlag", descending: sort.descending}];

grid.set("sort", sortAttributes);

grid.updateSortArrow(e.sort, true);

} }

edhager commented 6 years ago

Hi @07shawk,

It has been over a month since you opened this ticket. Did you find a solution? If not, can you provide more code that demonstrates the problem you are seeing?

Thanks!

msssk commented 4 years ago

Closing this issue as it lacks sufficient information to reproduce and has been inactive for a long time. If you continue to experience problems please open a new issue and provide a test case.