angular-ui/ui-grid

Custom sortingAlgorithm with large data set and virtualization

已關閉

#4,399 建立於 2015年9月18日

 (1 則留言) (0 個反應) (0 位負責人)JavaScript (2,496 個分叉)batch import
help wantedseverity: performancetype: FAQ

倉庫指標

星標
 (5,395 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

I have a date column that is stored as a string in the JSON. In order to sort this, I'm using a custom sortingAlgorithm on the column with the following definition:

{
    displayName: 'Date Approved',
    field: 'dateApproved',
    sortingAlgorithm: function (aDate, bDate) {
        var a = moment(aDate);
        var b = moment(bDate);
        if (a < b) {
            return -1;
        }
        else if (a > b) {
             return 1;
        }
        else {
            return 0;
        }
    }
}

This seems to work great for the first chunk of data, but once I get beyond maybe 60 rows or so, it falls apart and the sorting becomes random. For this particular grid, I have about 600 rows, with a filter applied that shows about 100. Is this a known issue?

貢獻者指南