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.

Performance issue when hiding rows

Thread ID:

Created:

Updated:

Platform:

Replies:

50138 Oct 6,2006 05:21 AM Nov 14,2006 12:01 PM Windows Forms 18
loading
Tags: Grouping
Marcelo Garcia Casil
Asked On October 6, 2006 05:21 AM

I''m having some serious performance issues when I hide rows on the grid.

I don''t think it''s the code as it''s very straighforward:

private void HideClosedPositions(bool hide)
{
this._grid.TableModel.BeginUpdate();
for (int i = 3; i <= this._grid.TableModel.RowCount; i++)
{
if (this.IsPositionClosed(i))
{
_grid.TableModel.Rows.Hidden[i] = hide;
}
}
this._grid.TableModel.EndUpdate();
}

IsPositionClosed(int) is a simple method that does a non time consuming validation.

It takes about 10 seconds to hide around 100 rows in a grid of 300 elements.

But the worst thing is that once the rows are hidden, the application craps out and it takes ages to scroll the grid. Also, the render of the grid fails and you can see many drawing errors as you scroll.

I attached a screenshot of how it looks. For security reasons I blurred some confidential data, but you still can tell what the problem is.

Any clues on what can be happening and possible solutions for it?

Many Thanks,

Marcelo



Screenshot25.zip

Marcelo Garcia Casil
Replied On October 6, 2006 11:14 AM

I also tried by using QueryRowHeight instead of the Hidden collection but outcome stays the same :-(

Find below the code:

private void TableModel_QueryRowHeight(object sender, GridRowColSizeEventArgs e)
{
if (this.IsPositionClosed(e.Index))
{
e.Size = (PositionAnalysisOptions.HideClosedPositions) ? 0 : 17;
e.Handled = true;
}
}

It looks like a grid bug to me...
Is there any workaround??

Also, I noticed that the scrollbars don''t get readjusted if rows are hidden or they height is changed. This results in a blank area at the bottom of the grid with its size equivalent to the sum of the sizes of the hidden rows.

I will very much appreciate any help ASAP.

Thanks,

Marcelo

Administrator [Syncfusion]
Replied On October 9, 2006 07:55 AM

Hi Marcelo,

Please refer the forum thread for more details.
http://www.syncfusion.com/support/forums/message.aspx?MessageID=45803

Let me know if you need any further assistance.

Thanks,
Haneef

Marcelo Garcia Casil
Replied On October 10, 2006 05:02 AM

Hi Haneef,

Thanks for your response, but I don''t see how that thread solves my problem. I managed to hide the rows I want. My issue is the grid rendering which gets corrupted after I hide a row or set its height to zero.

Please refer to the image I''ve attached and let me know what I can do to solve it.

Regards,

Marcelo

Marcelo Garcia Casil
Replied On October 10, 2006 05:02 AM

Hi Haneef,

Thanks for your response, but I don''t see how that thread solves my problem. I managed to hide the rows I want. My issue is the grid rendering which gets corrupted after I hide a row or set its height to zero.

Please refer to the image I''ve attached and let me know what I can do to solve it.

Regards,

Marcelo

Marcelo Garcia Casil
Replied On October 10, 2006 05:05 AM

Hi Haneef,

Thanks for your response, but I don''t see how that thread solves my problem. I managed to hide the rows I want. My issue is the grid rendering which gets corrupted after I hide a row or set its height to zero.

Please refer to the image I''ve attached and let me know what I can do to solve it.

Regards,

Marcelo

Administrator [Syncfusion]
Replied On October 10, 2006 07:35 AM

Hi Marcelo,

You would have to derive the GridRecordRow and override the GetYAmountCount method set the RowHeight of the record. Below is a code snippet

public override double GetYAmountCount()
{
// Note: whenever the value that is returned by GetYAmountCount changes
// make sure you call InvalidateCounterBottomUp so that the engine
// is aware of the change and counters are recalculated. See
// the RowHeight setter.
if( this.Kind == DisplayElementKind.Record)
{
if( IsHidden() )
{
this.InvalidateCounterBottomUp();
return 0;
}
}
return rowHeight != -1 ? rowHeight : base.GetYAmountCount();
}

Sample : http://www.syncfusion.com/Support/user/uploads/GGCHide_fdb7d2ff.zip

Please refer the Resizible Browser sample for more details.
Syncfusion\Essential Studio\4.3.0.25\windows\Grid.Grouping.Windows\Samples\ResizableRows\cs

Best Regards,
Haneef

Marcelo Garcia Casil
Replied On October 10, 2006 08:46 AM

Thanks for the sample, it is really useful. I''m currently working on implementing that into my code.
However, I noticed that the scrollbar doesn''t get adjusted to the proper height. Try modifying the code to make it display 100 rows and you''ll see what I mean.
Any workaround for that?

Thanks again,

Marcelo

Marcelo Garcia Casil
Replied On October 10, 2006 09:41 AM

I managed to implement your code in my application, but it overrides de CreateRecordRow() method, and I need to modify the hidden status after the grid has been generated, because it depends on a setting that the user can change at any time.
Is it possible to modify the hidden status without having to recreate the grid?

Thanks,

Marcelo

Marcelo Garcia Casil
Replied On October 17, 2006 05:01 AM

any help please??? I'm still waiting...

Marcelo Garcia Casil
Replied On October 25, 2006 11:15 AM

Am I going to get any feedback at all??

Thanks

Administrator [Syncfusion]
Replied On October 26, 2006 12:08 PM

Hello Marcelo,

Sorry for the inconvenience and the delay in replying. Hiding the rows through TableControl.Row.Hide will not sync., well with the Grouping Engine. Also setting the height to zero as in the ResizableRows sample will have performance issues.

The best way to do this would be to have an extra column in your DataTable say ‘HideStatus’ to keep track of the hidden rows. You can initially set the value to be false and apply filter from Grid to show the records that satisfy the false criteria. So whenever you need to hide a row, you just need to set the bool value of that Row field to true. This will be very faster.

Please refer this sample for the implementation: GGCHideRows

Thanks,
Calvin.

Marcelo Garcia Casil
Replied On November 6, 2006 11:38 AM

Hi Calvin,

Thanks for your response. I implemented your code in my project and it works fine, but I found a problem. When I group the grid, the hidden rows are not taken into account in the summary, and it is mandatory to consider the hidden rows in the summary.
With the previous approach, the rows were taken into account in the summary but the grid render crapped out.

Is there any workaround for this?

Thanks,

Marcelo

>Hello Marcelo,

Sorry for the inconvenience and the delay in replying. Hiding the rows through TableControl.Row.Hide will not sync., well with the Grouping Engine. Also setting the height to zero as in the ResizableRows sample will have performance issues.

The best way to do this would be to have an extra column in your DataTable say ‘HideStatus’ to keep track of the hidden rows. You can initially set the value to be false and apply filter from Grid to show the records that satisfy the false criteria. So whenever you need to hide a row, you just need to set the bool value of that Row field to true. This will be very faster.

Please refer this sample for the implementation: GGCHideRows

Thanks,
Calvin.

Marcelo Garcia Casil
Replied On November 13, 2006 04:31 AM

Please I need a response ASAP

Administrator [Syncfusion]
Replied On November 13, 2006 06:03 AM

Hi Marcelo,

Please refer to the below forum thread which discuss with the simillar issue.
http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=39832

Best Regards,
Haneef

Jayakumar Natarajan [Syncfusion]
Replied On November 13, 2006 12:35 PM

Hi Marcelo,
Please set the GridSummaryColumnDescriptor.IgnoreRecordFilterCriteria to true. By default, it is set to false. This will calculate summaries ignoring the filter criteria.

Here is the modified sample:

GGCHide.zip



///

/// Specifies whether RecordFilter criteria should be ignored and

/// the summary should be calculated for all records.

///


[RefreshProperties(RefreshProperties.All)]

[Description("Specifies whether RecordFilter criteria should be ignored and the summary should be calculated for all records.")]

[DefaultValue(false)]

public bool IgnoreRecordFilterCriteria



Thanks,
Jay

Marcelo Garcia Casil
Replied On November 14, 2006 06:50 AM

Thanks for pointing to that thread. I read it and looked at all the samples. However, it doesn't fit my requirement. That solution applies to empty groups, which is not my case. I just need the summary to take into account the filtered rows.

If you can point out the steps I need to follow to achieve that I will be very grateful.

Many thanks,

Marcelo

Jayakumar Natarajan [Syncfusion]
Replied On November 14, 2006 09:46 AM

Hi Marcelo,
Have you tried setting the IgnoreRecordFilterCriteria property that I posted in the last thread? It also has a sample.

Best regards,
Jay

Marcelo Garcia Casil
Replied On November 14, 2006 12:01 PM

Hi Jay,

I implemented your solution in my code and it worked like a breeze. That was exactly what I was looking for.

Many Thanks!

Marcelo

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.

;