ui-grid icon indicating copy to clipboard operation
ui-grid copied to clipboard

Grouping causes data resort which is not good with a large data set when external sorting and dynamic data loading is enabled.

Open shazzababs opened this issue 12 years ago • 0 comments

When dynamic data loading and external sorting is enabled grouping causes a different set of data to be requested with a new sort order. This sort request also re-occurs when the next page is requested, or the page size changed.

As I have a large data set, and only request the visible data items at any one point I want to be able to apply the grouping to just the currently visible set of data (i.e. without the sort), so the user just sees the current dataset but grouped.

I've fixed it for myself by adding an extra if statement into the 'groupBy' function which removes the data sort on grouping if external sorting is enabled, but it would be nice to have it as an option on the grouping functionality:

$scope.groupBy = function (col) {
        if (self.data.length < 1 || !col.groupable  || !col.field) {
            return;
        }
        if (!self.config.useExternalSorting)
        {
            //first sort the column
            if (!col.sortDirection) {
              col.sort({ shiftKey: $scope.configGroups.length > 0 ? true : false });
            }
        }

shazzababs avatar Dec 20 '13 13:12 shazzababs