andyhill Posted June 28, 2022 Posted June 28, 2022 Please advise how to "Mobile DBListGrid scroll selected row into view via code" - thanks. Quote
Sherzod Posted June 29, 2022 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? Quote
andyhill Posted June 29, 2022 Author 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 Quote
Sherzod Posted June 29, 2022 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; Quote
andyhill Posted June 29, 2022 Author 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 ? Quote
Sherzod Posted June 29, 2022 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; Quote
andyhill Posted June 29, 2022 Author Posted June 29, 2022 Sherzod, you are amazing - perfect - thank you 1 Quote
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.