Servant5166 Posted December 28, 2017 Share Posted December 28, 2017 Hi, How can I sort the TreeGrid in descending order? I need to show Contract Numbers like (C2017220, C2017210, C2017190) with the latest contract first. The data use ID and ParentID relationship, for example, ParentID (0220) ID (0221, 0222) Using UniGui 1.0.0.1420 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 29, 2017 Share Posted December 29, 2017 Hi, Do you mean sorting the child nodes ?! Quote Link to comment Share on other sites More sharing options...
Servant5166 Posted December 31, 2017 Author Share Posted December 31, 2017 Hi, Do you mean sorting the child nodes ?! No, What I would like is to have the ID column to sort in descending order. My customer wants to see the last contract created first in the TreeGrid. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 31, 2017 Share Posted December 31, 2017 Ok Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 31, 2017 Share Posted December 31, 2017 Hi, Can you try this approach for now ?! For example: property:0 -> 0 - ID index UniDBTreeGrid1 -> ClientEvents -> ExtEvents -> Ext.data.TreeStore [store] -> function store.load: function store.load(sender, node, records, successful, eOpts) { var me=sender; me.remoteSort=false; me.sort({property:0, direction:"DESC"}); } Best regards, Quote Link to comment Share on other sites More sharing options...
Servant5166 Posted December 31, 2017 Author Share Posted December 31, 2017 Hi, Can you try this approach for now ?! For example: property:0 -> 0 - ID index UniDBTreeGrid1 -> ClientEvents -> ExtEvents -> Ext.data.TreeStore [store] -> function store.load: function store.load(sender, node, records, successful, eOpts) { var me=sender; me.remoteSort=false; me.sort({property:0, direction:"DESC"}); } Best regards, Hi, I can't find the function Ext.data.Treestore you mention. I using Delphi 10.2 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 1, 2018 Share Posted January 1, 2018 Hi, I can't find the function Ext.data.Treestore you mention. I using Delphi 10.2 Quote Link to comment Share on other sites More sharing options...
Servant5166 Posted January 1, 2018 Author Share Posted January 1, 2018 Thanks, you’re the bomb dot com Sent from my iPad using Tapatalk Quote Link to comment Share on other sites More sharing options...
Servant5166 Posted January 1, 2018 Author Share Posted January 1, 2018 storeload.png Hi, One more question. Is there a way to move the record pointer to the first record? When I apply the code you supplied me, it orders the data as expected, but the record pointer is at the bottom of the grid. That means the user will have to manually scroll to the top to see the first record. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 1, 2018 Share Posted January 1, 2018 Hi, "I couldn't reproduce this..." Maybe you need this?: function store.load(sender, node, records, successful, eOpts) { var me=sender; me.remoteSort=false; me.sort({property:0, direction:"DESC"}); me.grid.getSelectionModel().select(0); //<------------- } Best regards, Quote Link to comment Share on other sites More sharing options...
Servant5166 Posted January 1, 2018 Author Share Posted January 1, 2018 Hi, I've attached a screenshot to demonstrate the issue. At the lower right of the graphic, you'll see the DBTreeGrid scrollbar which is at the bottom. The record at the top of the DBTreeGrid is highlighted because I see the contract number in the status bar. Thanks for your help. Quote Link to comment Share on other sites More sharing options...
Servant5166 Posted September 9, 2018 Author Share Posted September 9, 2018 Is there a solution for this? I need to select the first record after sorting. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 9, 2018 Share Posted September 9, 2018 Hi, Can you make a simple testcase for this?! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.