We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Bring specific record into view

Hi,
I have a datatable with lets say 1000 rows, and I programatically add a new row. As the rows are sorted by name, the row is inserted somewhere in the middle. I want to programmatically make the GridDataControl to bring this specific record into view. I know the rows ID.

Something like the ScrollIntoView(item) method that the listbox has.

Thanks
Chris

2 Replies

SA Santhosh March 28, 2014 01:22 PM UTC

Hi Chris,

You can bring the newly added record to view by moving the current cell to the newly added record.

Refer the below snippets [C#].

 //Getting the record index of the newly added record.
           int recordIndex= this.SyncGrid.Model.View.Records.IndexOfRecord(newlyAddedRecord);
            //Getting the rowindex by resolving the record index.
           int rowIndex = this.SyncGrid.Model.ResolvePositionToIndex(recordIndex);

           //Moving the currentcell to the newly added record and scrolling to view.
           if(this.SyncGrid.Model.Grid.CurrentCell.MoveTo(rowIndex, 0))
               SyncGrid.Model.Grid.CurrentCell.ScrollInView();

hope this will help you.

Santhosh


SM Saravanan M Syncfusion Team April 8, 2014 01:02 PM UTC

Hi Chris,

Thank you for interesting in Syncfusion Products,

 We have analyzed your query. You can bring the particular row in the view by moving the current cell to newly added row. Please refer the below API..

 Code snippet[C#]:


this.Syncgrid.Model.CurrencyManager.CurrentCell.MoveTo(rowIndex + 1, 0);

this.Syncgrid.Model.CurrencyManager.CurrentCell.ScrollInView();

 

 

We have prepared a sample based on your requirement and you can download the sample from attachment.

 

Please let us know if you have any queries,

 

Regards,

Saravanan.M

 

 


Attachment: GridDataControl_Sample_217cab9d.zip

Loader.
Live Chat Icon For mobile
Up arrow icon