extjs4 - Sorting a treeStore in extJs messing up with the application -
i have treestore ('planscreenstore') i'm accessing in following way :
updatestore : function() { rootnodeid = globals.globalmodel.planlist.scope._id; var planscreenstorerootnode = this.planscreenstore.getrootnode(); if (!(planscreenstorerootnode === undefined)) { planscreenstorerootnode.removeall(); } if (globals.globalmodel.planlist.children.length > 0) { planscreenstorerootnode.appendchild( globals.globalmodel.planlist.children); globals.globalmodel.planlist.children = planscreenstorerootnode; globals.globalmodel.planlistforcreatenewplan = planscreenstorerootnode; }
i have sort treestore on basis of field 'text'. have been able in following 2 ways:
updatestore : function() { debugger; rootnodeid = globals.globalmodel.planlist.scope._id; var planscreenstorerootnode = this.planscreenstore.getrootnode(); if (!(planscreenstorerootnode === undefined)) { planscreenstorerootnode.removeall(); } if (globals.globalmodel.planlist.children.length > 0) { planscreenstorerootnode.appendchild( globals.globalmodel.planlist.children); globals.globalmodel.planlist.children = planscreenstorerootnode; globals.globalmodel.planlistforcreatenewplan = planscreenstorerootnode; } this.planscreenstore.sort('text','asc');
and other one:
updatestore : function() { debugger; rootnodeid = globals.globalmodel.planlist.scope._id; var planscreenstorerootnode = this.planscreenstore.getrootnode(); if (!(planscreenstorerootnode === undefined)) { planscreenstorerootnode.removeall(); } if (globals.globalmodel.planlist.children.length > 0) { planscreenstorerootnode.appendchild( globals.globalmodel.planlist.children); globals.globalmodel.planlist.children = planscreenstorerootnode; globals.globalmodel.planlistforcreatenewplan = planscreenstorerootnode; } planscreenstorerootnode.sort(function(n1, n2) { debugger ; var v1 = n1.data['text'].touppercase(); var v2 = n2.data['text'].touppercase(); if (v1 < v2) return -1; else if (v1 > v2) return 1; return 0; });
i desired result both methods somehow in both cases, application crashes after sorting performed while works entirely fine without either of sorting applied. related how i'm accessing nodeinterface (planscreenrootnode). how can resolve this?
Comments
Post a Comment