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.

GridControl RemoveRange and hidden rows

Thread ID:

Created:

Updated:

Platform:

Replies:

55916 Feb 6,2007 06:21 PM Feb 7,2007 07:01 PM Windows Forms 10
loading
Tags: GridControl
Julie Levy
Asked On February 6, 2007 06:21 PM

Hi -
I am calling RemoveRange to remove rows from my grid. However, some of the rows may be hidden. RemoveRange doesn't seem to consider these rows.
For example, i have the following rows;
Row1 - visible
Row2 - hidden
Row3 - hidden
Row4 - visible
Row5 - visible
Row6 - visible
By checking a property on each row i decide Rows 1 through 3 should be removed. I call RemoveRows(1, 3). However, the rows removed are actually 1, 4 and 5.

Is there a way to remove a range of rows and have the hidden rows included in the range? We are on version 4.4.0.51

Thanks,
Julie

Administrator [Syncfusion]
Replied On February 6, 2007 06:55 PM

Hi Julie,

The reason for this behavior is that, the hidden rows are not properly cleared before removing them. So, you need to call Rows.Hidden.ResetRange() to reset the rows before removing them. Please try the code snippet

this.GridControl1.Model.Rows.Hidden.ResetRange(1, 3)
this.GridControl1.Model.Rows.RemoveRange(1, 3)

Best Regards,
Haneef

Julie Levy
Replied On February 6, 2007 07:44 PM

Haneef -
thanks for your response. This helps, but there seems to be a refresh problem. It looks like the wrong rows are removed until i reload the grid and then everything looks fine. Is there something else i need to call to update things without reloading? Note that calling Refresh doesn't help.
Thanks,
Julie

Julie Levy
Replied On February 6, 2007 07:47 PM

one more bit of info: there are other hidden rows that i am not removing.

Administrator [Syncfusion]
Replied On February 7, 2007 12:09 PM

Hi Julie,

Thanks for the update and for being patience. Is it possible for you to explain us more details or modify the sample, so it help us to solve your issue earlier. The following is the attachment demonstrates the RemoveRange is working fine for the sample, please let us know if you meant different scenario.

Here is a sample.
GC_Remove.zip

Best regards,
Haneef

Julie Levy
Replied On February 7, 2007 02:38 PM

Thanks Haneef. Here is your sample updated. I've added ranges as header rows to the grid and updated what rows are hidden and then removed. Keep an eye out on row 13 which is never hidden or removed.
Julie

GC_RemoveRows.zip

Administrator [Syncfusion]
Replied On February 7, 2007 03:50 PM

Hi Julie,

The reason for this behavior is that you are setting the 10th as a hidden row. After deleting the three rows(6-8) from the grid, 13th row becomes the 10th one(which is hidden).So try resetting the all hidden rows in a grid.

this.gridControl1.Model.Rows.Hidden.ResetRange(1,this.gridControl1.Model.RowCount);
this.gridControl1.Model.Rows.RemoveRange(6,8);
//set the hidden rows....here..

this.Refresh();

Best regards,
Haneef

Julie Levy
Replied On February 7, 2007 04:54 PM

Thanks Haneef -
I was hoping there was a way to do this without showing all of the hidden rows. It's too bad the hidden row indexes can't be updated when rows are removed from the grid. I can't really track what was hidden before the remove without reloading the grid and i am using RemoveRange to specifically avoid reloading.
Thanks for your help,
Julie

Julie Levy
Replied On February 7, 2007 06:31 PM

By the way, I also had a really bad refresh problem where i would load different data into the grid after having loaded data with hidden rows and there would be hidden rows even though i wasn't specifically hiding them and had cleared all the rows out before reloading. I solved this by calling this.Model.Rows.Hidden.ResetRange( 1, this.RowCount ) before clearing out all the rows (setting rowcount to 0)
Is this a bug, or how it is supposed to work? I also have to set the FrozenCount to 0 even though i have set the rowcount to 0. Is there a better way to clear out the rows in preparation for loading new data?
Thanks,
Julie

Administrator [Syncfusion]
Replied On February 7, 2007 06:45 PM

Hi Julie,

Is there a better way to clear out the rows in preparation for loading new data?

>>>>>
Try calling the Model.ClearCells() method to clear the specified range of cells in a grid.

this.Grid.Model.ClearCells(GridRangeInfo.Rows(1,3),true) ;
this.Grid.Refresh();

Thanks,
Haneef

Julie Levy
Replied On February 7, 2007 07:01 PM

Thanks Haneef -
this actually produced even worse results for me so i'm sticking with my other approach. It seems to work for now.
Thanks again for your quick responses,
Julie

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.

;