javascript - dgrid custom sort issue -


i'm trying override sort logic in dgrid suggested kfranqueiro in link - https://github.com/sitepen/dgrid/issues/276.

i data server in sorted order , want update ui of column header. i'm doing -

on(mygrid, 'dgrid-sort', lang.hitch( this,function(event){     var sort = event.sort[0];     var order = this.sort.descending ? "descending" : "ascending";     console.log("sort "+ this.sort.property + " in " +order+" order.");     event.preventdefault();     mygrid.updatesortarrow(event.sort, true);     myfunctiontorefreshgrid(); })); ... myfunctiontorefreshgrid: function() {    ...//get data server in sorted order    var mystore = new memory({data: sorteddatafromserver, idproperty: 'id'});    mygrid.set("collection", mystore);    ... } 

memory here "dstore/memory". i'm using dgrid 0.4, dstore 1.1 , dojo 1.10.4

before calling set('collection',...) see sorteddatafromserver in desired sorted order. reason, order in grid different. example, when sorted in descending order, see values starting lower case appear first in descending order , values starting upper case appear in sorted order. looks dstore doing more.

what going on? doing wrong? there different/better way custom sorting?

thanks,

this how ended addressing situation - suspected, collection/store further sorting data , hence inconsistency. customized store (memory) shown below , use custom store when setting data grid.

var customgridstore = declare([memory],{     sort: function (sorted) {         sorted = [];//prevent collection sorting data         return this.inherited(arguments);     } }); 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -