andyhill Posted June 28, 2022 Share Posted June 28, 2022 Please advise how to "Mobile DBListGrid scroll selected row into view via code" - thanks. Link to comment Share on other sites More sharing options...
Sherzod Posted June 29, 2022 Share Posted June 29, 2022 5 hours ago, andyhill said: how to "Mobile DBListGrid scroll selected row into view via code" Hello, Can you please explain in more detail? Link to comment Share on other sites More sharing options...
andyhill Posted June 29, 2022 Author Share Posted June 29, 2022 Grid has 500 records Records 1 to 30 are displayed In code we use table.locate record 300 Record 300 is selected BUT out of view Scroll selected row into view via code Link to comment Share on other sites More sharing options...
Sherzod Posted June 29, 2022 Share Posted June 29, 2022 Okay. Link to comment Share on other sites More sharing options...
Sherzod Posted June 29, 2022 Share Posted June 29, 2022 1 hour ago, andyhill said: Grid has 500 records Records 1 to 30 are displayed In code we use table.locate record 300 Record 300 is selected BUT out of view Scroll selected row into view via code Try this approach, for example: procedure TMainmForm.UnimButton1Click(Sender: TObject); begin with UniMainModule do begin DataSource1.DataSet.Locate('Species No', 90130, [loPartialKey]); UnimDBListGrid1.JSInterface.JSCallDefer('ensureVisible', [JSInterface.JSStatement(UnimDBListGrid1.JSName + '.getLastSelected()')], 50); end; end; Link to comment Share on other sites More sharing options...
andyhill Posted June 29, 2022 Author Share Posted June 29, 2022 Thank you Sherzod, the selected record is now the last visible row in the grid What if we wanted to see this record in the middle of the visible rows eg. records 285 to 315 are now visible records in the grid, can we get our selected record 300 to display in the middle of the current visible rows ? Link to comment Share on other sites More sharing options...
Sherzod Posted June 29, 2022 Share Posted June 29, 2022 I will check. Link to comment Share on other sites More sharing options...
Sherzod Posted June 29, 2022 Share Posted June 29, 2022 53 minutes ago, andyhill said: What if we wanted to see this record in the middle of the visible rows Try this approach: procedure TMainmForm.UnimButton1Click(Sender: TObject); begin with UniMainModule do begin DataSource1.DataSet.Locate('Species No', 90170, [loPartialKey]); UnimDBListGrid1.JSInterface.JSCode('Ext.defer(function(){'#1'.element.select(".x-selected").elements[0].scrollIntoView({block: "center", behavior: "smooth"})}, 50);'); //<--------- end; end; Link to comment Share on other sites More sharing options...
andyhill Posted June 29, 2022 Author Share Posted June 29, 2022 Sherzod, you are amazing - perfect - thank you 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now