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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Bring specific record into view

Thread ID:

Created:

Updated:

Platform:

Replies:

116039 Mar 21,2014 07:03 PM UTC Apr 8,2014 01:02 PM UTC WPF 2
loading
Tags: GridDataControl
Chris Valasellis
Asked On March 21, 2014 07:03 PM UTC

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

Santhosh
Replied On 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

Saravanan M [Syncfusion]
Replied On 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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;