erich.wanker Posted October 30, 2018 Share Posted October 30, 2018 after filtering a table - i want to select all records why does this not work? procedure Tkunden_fakturieren.DSTRUKTUR1DataChange(Sender: TObject; Field: TField); begin liste.SQL.Clear; liste.SQL.Append('SELECT * FROM ANTEILE WHERE GUNST_INR = '+STRUKTUR1.FieldByName('INR').asstring+' ORDER BY VERTRAG_NR desc '); liste.Open; UniDBGrid1.JSInterface.JSCall('getSelectionModel().selectAll', []); // i also tryed: UniSession.AddJS(UniDBGrid1.JSName + '.getSelectionModel().selectAll();'); end; .. just the focused record has a checked Checkbox Thanx for Help Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 30, 2018 Share Posted October 30, 2018 Hi Erich, Which build are you using ? Can you make a simple testcase for this ? Quote Link to comment Share on other sites More sharing options...
erich.wanker Posted October 30, 2018 Author Share Posted October 30, 2018 Hi, i use 1.50.0.1480 .. i want that ALL checkboxes are checked (multiselect = true) in a unibdGrid after i make a "select * from table" actual i have this (with the posted code) but i want this: Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 30, 2018 Share Posted October 30, 2018 Maybe you should try this approach for now: 1. YourGrid.JSInterface.JSAssign('needToSelectAll', [True]); //<--------- liste.SQL.Clear; liste.SQL.Append('SELECT * FROM ANTEILE WHERE GUNST_INR = '+STRUKTUR1.FieldByName('INR').asstring+' ORDER BY VERTRAG_NR desc '); liste.Open; 2. YourGrid -> ClientEvents -> ExtEvents -> function store.load // or use the OnAfterLoad event of your Grid with some conditions function store.load(sender, records, successful, operation, eOpts) { if (sender.grid.needToSelectAll) { Ext.defer(function () { sender.grid.getSelectionModel().selectAll() }, 100); } } 1 Quote Link to comment Share on other sites More sharing options...
erich.wanker Posted October 30, 2018 Author Share Posted October 30, 2018 PERFECT ! ThanX a lot :-) Quote Link to comment Share on other sites More sharing options...
Roberto Nicchi Posted May 11, 2021 Share Posted May 11, 2021 On 10/30/2018 at 1:48 PM, Sherzod said: Maybe you should try this approach for now: 1. YourGrid.JSInterface.JSAssign('needToSelectAll', [True]); //<--------- liste.SQL.Clear; liste.SQL.Append('SELECT * FROM ANTEILE WHERE GUNST_INR = '+STRUKTUR1.FieldByName('INR').asstring+' ORDER BY VERTRAG_NR desc '); liste.Open; 2. YourGrid -> ClientEvents -> ExtEvents -> function store.load // or use the OnAfterLoad event of your Grid with some conditions function store.load(sender, records, successful, operation, eOpts) { if (sender.grid.needToSelectAll) { Ext.defer(function () { sender.grid.getSelectionModel().selectAll() }, 100); } } I'm trying this thing but sincerly i don't understand in what ext event i have to place the store.load function. I'm new to JS and UNIGUI I have tryed also to place the code UniSession.AddJS(UniDBGrid1.JSName + '.getSelectionModel().selectAll();'); in the onafterload event of the grid but it has no effect. If i use the same code in a popup menu works fine. thanks Quote Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted May 11, 2021 Share Posted May 11, 2021 1 hour ago, Roberto Nicchi said: I'm trying this thing but sincerly i don't understand in what ext event i have to place the store.load function. I'm new to JS and UNIGUI I have tryed also to place the code UniSession.AddJS(UniDBGrid1.JSName + '.getSelectionModel().selectAll();'); in the onafterload event of the grid but it has no effect. If i use the same code in a popup menu works fine. thanks Hello Please try below code procedure TMainForm.DBGridAfterLoad(Sender: TUniCustomDBGrid); begin with UniDBGrid1, JSInterface do JSCallDefer('getSelectionModel().selectAll', [], 100 ); end; 1 Quote Link to comment Share on other sites More sharing options...
Roberto Nicchi Posted May 11, 2021 Share Posted May 11, 2021 37 minutes ago, Hayri ASLAN said: Hello Please try below code procedure TMainForm.DBGridAfterLoad(Sender: TUniCustomDBGrid); begin with UniDBGrid1, JSInterface do JSCallDefer('getSelectionModel().selectAll', [], 100 ); end; This works fine, thanks 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.