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.
Unfortunately, activation email could not send to your email. Please try again.

Newly inserted records go to the top of the grid

Thread ID:

Created:

Updated:

Platform:

Replies:

11311 Mar 2,2004 08:25 AM Apr 26,2005 04:23 PM Windows Forms 4
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On March 2, 2004 08:25 AM

When a user inserts a row to the grid and do a database update, the newly inserted records go to the top of the grid. Is there a way to solve this problem (ie to preserve the position of the inserted row)? Thanks in advance

Administrator [Syncfusion]
Replied On March 2, 2004 11:46 AM

The grid just reflects what the datasource does. So, if the datasource sorts the new values, the grid displays them sorted. If you grid is sorted, then when new data is saved, it will automatically be position properly with respect to sort order. The only way to avoid this without going to historic effects is to not have the data sorted when you want to edit it.

Gene Gorokhovsky
Replied On March 16, 2004 07:50 AM

Actually the fact that edited and new record "jump" around when user edits them and datasource is sorted is slighly annoying. Here is a way to work around that: *Create a class derived from DataView. *In it, add an integer column to your datasource. *Override IBdindingList.ApplySort to sort by requested column, then copy row numbers into this new special "sort freezer" column. Set sort internally to be on that column, instead of the one passed to ApplySort. *override other IBindingList interfaces to correctly report publicly visible sort order. If you bind to this derived DataView, edited and new rows are not going to jump until user explicitly clicks column header. I have attached a code fragment that implements the idea outlined above. Gene > The grid just reflects what the datasource does. So, if the datasource sorts the new values, the grid displays them sorted. > > If you grid is sorted, then when new data is saved, it will automatically be position properly with respect to sort order. The only way to avoid this without going to historic effects is to not have the data sorted when you want to edit it.

Administrator [Syncfusion]
Replied On April 26, 2005 11:08 AM

Couldn''t find the attached file. >Actually the fact that edited and new record "jump" around when user edits them and datasource is sorted is slighly annoying. > >Here is a way to work around that: >*Create a class derived from DataView. >*In it, add an integer column to your datasource. >*Override IBdindingList.ApplySort to sort by requested column, then copy row numbers into this new special "sort freezer" column. Set sort internally to be on that column, instead of the one passed to ApplySort. >*override other IBindingList interfaces to correctly report publicly visible sort order. > >If you bind to this derived DataView, edited and new rows are not going to jump until user explicitly clicks column header. > >I have attached a code fragment that implements >the idea outlined above. > >Gene > > > The grid just reflects what the datasource does. So, if the datasource sorts the new values, the grid displays them sorted. >> >> If you grid is sorted, then when new data is saved, it will automatically be position properly with respect to sort order. The only way to avoid this without going to historic effects is to not have the data sorted when you want to edit it. >

Administrator [Syncfusion]
Replied On April 26, 2005 04:23 PM

Hi Bits, Here is the link to the file: http://64.78.52.104/Support/Forums/Uploads/GridDataView.zip Best regards, Jay N

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.

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.

;