How to freeze or lock scrollbar while continuous adding rows and user want to check particular row.

Hi.

We have used SfDataGrid to show logs, logs are getting inserted at 0 index in list approx per seconds. So that last log should be on top.
But when we scroll to check first log, Scroll bar changes it position as rows are getting added in list.
How can we handle this in SfDataGrid, How to disable/freeze auto scrolling ?

Thanks
Santosh Bhivase

12 Replies

SE Selvamz September 3, 2019 12:32 PM UTC

Any update for this? I want to achieve the same functionality in UWP SfDataGrid.



GG Gowtham Gopalsamy Syncfusion Team September 4, 2019 01:45 PM UTC

Hi Santosh, 
 
Thanks for contacting Syncfusion support. 
 
We can reproduce your scenario at our end .You can achieve your requirement to maintain the first log in the view by using ScrollInView method. 
 
Please find the below code snippet, 
    
DispatcherTimer dispatcherTimer = new DispatcherTimer(); 
dispatcherTimer.Tick += DispatcherTimer_Tick; 
dispatcherTimer.Interval = new TimeSpan(0, 0, 1); 
dispatcherTimer.Start(); 
 
private void DispatcherTimer_Tick(object sender, object e) 
{ 
    var collection = (this.dataGrid.DataContext as ViewModel.ViewModel).OrdersInfo; 
    collection.Insert(0, new OrderInfo() { OrderID = 100, EmployeeID = 100111, ShipCity = "China", ShipCountry = "Japan" }); 
 
    var index = collection.IndexOf(collection.FirstOrDefault(x=>x.OrderID == 10000)); 
    var resolveIndex = this.dataGrid.ResolveToRowIndex(index); 
    this.dataGrid.ScrollInView(new Syncfusion.UI.Xaml.ScrollAxis.RowColumnIndex(resolveIndex, 0)); 
 
} 
 
private async void Stoper() 
{ 
    dispatcherTimer.Stop(); 
} 
    
Please refer sample in following link,    
    
 
We appreciate your patience until then. 
 
Regards, 
Gowtham 



SE Selvamz September 5, 2019 01:15 PM UTC

Hi Gowtham, Thanks for the reply and sample.

That sample working fine to keep same visible rows on inserting rows. 

But seems having some weird behavior when scroll to last row and start inserting records. Some of top rows are jumping (flickering). It happening only when start inserting rows after scroll to last row(end). If we start inserting at any other scroll position, its working fine.

Please check with attached sample.

1. Scroll to last row.
2. Click Start button.


Below screenshot captured while flickering of rows.





Attachment: DemoMasterDetails__Copy_c9b802e0.zip


GG Gowtham Gopalsamy Syncfusion Team September 6, 2019 12:48 PM UTC

Hi Selvamz,   
   
Thanks for your patience.   
  
As provided in the previous update, when the record is added at the top of the grid the scrollbar position is maintained in the initially added record. But when we analyzed your sample, you have added the record at the top of the grid and maintained the scrollbar position in the last record. At that time, the record was added on top and the scrollbar is moved to the last record. So, the flickering is occurring. To analyze the flickering issue, we need two business days so will provide more details on 10th sept,2019.  
   
We appreciate your patience until then.  
   
Regards,   
Gowtham  



SE Selvamz September 11, 2019 09:35 AM UTC

Any update on this?


SE Selvamz September 12, 2019 06:02 AM UTC

Could you please provide any workaround for time being?


GG Gowtham Gopalsamy Syncfusion Team September 12, 2019 11:43 AM UTC

Hi Selvamz,   
  
Thanks for your patience.     
  
Your requirement can be achieved by scrolling to last row and inserting the records top of the grid without jumping (flickering) by using ChangeView method.   
   
Please refer the below code snippet.  
   
var collection = (this.dataGrid.DataContext as ViewModel.ViewModel).OrdersInfo;   
collection.Insert(0, new OrderInfo() { OrderID = 100, EmployeeID = 100111, ShipCity ="China", ShipCountry = "Japan" });   
var index = collection.IndexOf(collection.FirstOrDefault(x => x.OrderID == 10499));   
var resolveIndex = this.dataGrid.ResolveToRowIndex(index);   
     
this.dataGrid.GetVisualContainer().ScrollOwner.ChangeView(0, (this.dataGrid.GetVisualContainer().ScrollRows as PixelScrollAxis).TotalExtent, 1, true);   
   
  
Please refer the below sample link.   
   
   
Regards,      
Gowtham      



SE Selvamz September 13, 2019 06:08 AM UTC

Hi Gowtham,

That provided workaround also not working correctly. There are 3 scenarios, try with attached sample.

Scenario 1: Working fine as expected
  1. Scroll down to middle of scroll bar. (i.e., last visible row is Patient135)
  2. Click Async Add Items button.
  3. See the items are inserting at top silently. No flickering or jumping at UI. (This is expected)
Scenario 2: UI is jumping
  1. Scroll to last row. (i.e., Patient299)
  2. Click Async Add Items button.
  3. See the UI is jumping and not scrolled to last row when tried with your workaround.
Scenario 3: Header and UI flickering as previously reported.
  1. Scroll down to two rows previous of last row (i.e., last visible row is Patient297)
  2. Click Async Add Items button.
  3. See the UI and header row is flickering which is the previously reported issue.

Attachment: SyncfusionDataGridSample_45b62963.zip


GG Gowtham Gopalsamy Syncfusion Team September 16, 2019 02:14 PM UTC

Hi Anshul 
  
Thanks for your patience.    
  
We have reproduced your issue “to add the record at the top of the datagrid in async” from our end. We are working the issue with your sample. We will provide more details on 18th September,2019.  
 
We appreciate your patience until then.     
Regards,     
Gowtham    



GG Gowtham Gopalsamy Syncfusion Team September 18, 2019 03:05 PM UTC

Hi Selvamz 
 
Thanks for your patience 
 
We are analyzing your mentioned issue with provided sample. We will update more details on 19th September,2019. 
 
We will appreciate your patience until then.  
 
Regards,  
Gowtham 



GG Gowtham Gopalsamy Syncfusion Team September 19, 2019 01:45 PM UTC

Hi Selvamz 
 
Thanks for your patience 
 
We have analyzed to achieve this flickering in sample level. But We couldn’t resolve this flickering. Now we are analyzing the source to fix the flickering issue. So, we need two more business days to fix this issue. We will update more details on 23 September,2019. 
  
We will appreciate your patience until then.  
 
Regards,  
Gowtham 



FP Farjana Parveen Ayubb Syncfusion Team September 24, 2019 09:04 AM UTC

Hi Selvamz 
  
Currently we don’t have a support for maintain the scrollbar in required position on updating the data at run time, So we have considered to provide support for “Support to maintain the scrollbar in required position on updating the data at run time” in UWP SfDataGrid and logged feature request for the same. We will implement this feature in any of our upcoming release.   
  
At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision, technological feasibility, and customer interest. We will let you know when this feature is implemented. We appreciate your patience until then.  
  
Thank you for requesting this feature and helping us define it. We are always trying to make our products better and feature requests like yours are a key part of our product growth efforts.  
  
  
 
If you have any more specification/suggestions to the feature request, you can add it as a comment in the portal and cast your vote to make it count.  
  
Regards,  
Farjana Parveen A 


Loader.
Up arrow icon