How remember last position?

Maybe you know the solution to my question. I have two tabs open with tables. I work in one list, I am on line 923 (for example), switch to the next tab, go back and ... the table shows the first record.
Im use DocumentContainer + sfDataGrid.
My situation on screens.
Screen 1

Screen 2

5 Replies 1 reply marked as answer

MA Mohanram Anbukkarasu Syncfusion Team February 9, 2021 03:40 PM UTC

Hi Ruslan, 
 
Thanks for contacting Syncfusion support.  
 
We have prepared a sample using DocumenContainer and SfDataGrid to replicate your scenario. But unfortunately we are unable to reproduce the reported problem in our end. The scrollbar position of the SfDataGrid is maintained in the same position when we switch between the tabs. The sample we have used to check this scenario is available in the following link for your reference.  
 
 
Please have a look at this sample and let us know if we have missed any customization you have done in your application. Or try to reproduce the reported problem in this sample. It will be more helpful for us to find the exact cause for the problem and to provide a prompt solution at earlier.  
 
Regards, 
Mohanram A. 



RU ruslik February 10, 2021 07:42 AM UTC

Sorry, I didn't finish the structure of the program. The main form is a window. It contains a ribbon with buttons. At the bottom of the document container, clickable user controls are loaded into it. And already inside each of the controls there is a grid and other elements.
Maybe I don't understand something. Your example works. But your tabs are loaded right away, mine are loaded by clicking on the ribbon buttons. Below is my program structure.

Picture


MA Mohanram Anbukkarasu Syncfusion Team February 11, 2021 12:09 PM UTC

Hi Ruslan, 

Thanks for the update.  

We are little unclear with your scenario. However you can achieve your requirement by getting the scroll value of the DataGrid when the  DataGrid is unloaded and reset the scroll value when the DataGrid is loaded again as shown in the following code example.  

Code example :  

this.dataGrid.Loaded += DataGrid_Loaded; 
this.dataGrid.Unloaded += DataGrid_Unloaded; 
 
double scrollValue; 
 
private void DataGrid_Unloaded(object sender, RoutedEventArgs e) 
{ 
    scrollValue = this.dataGrid.GetVisualContainer().ScrollRows.ScrollBar.Value; 
} 
 
 
private void DataGrid_Loaded(object sender, RoutedEventArgs e) 
{ 
    this.dataGrid.GetVisualContainer().ScrollRows.ScrollBar.Value = scrollValue; 
} 

Also please refer the below given help documentation which may help you.  


Please revert to us with detail if this doesn’t meet your requirement.  

Regards, 
Mohanram A. 


Marked as answer

RU ruslik February 12, 2021 09:48 AM UTC

Thanks, it works. Didn't read about this option.


MA Mohanram Anbukkarasu Syncfusion Team February 12, 2021 12:06 PM UTC

Hi Ruslan, 

Thanks for the update. 

We are glad to know that the provided solution worked at your end. Please let us know if you have any further queries on this. We are happy to help you. 

Regards, 
Mohanram A. 


Loader.
Up arrow icon