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

Performance issue when hiding rows

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

18 Replies

MG Marcelo Garcia Casil October 6, 2006 03:14 PM UTC

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


AD Administrator Syncfusion Team October 9, 2006 11:55 AM UTC

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


MG Marcelo Garcia Casil October 10, 2006 09:02 AM UTC

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


MG Marcelo Garcia Casil October 10, 2006 09:02 AM UTC

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


MG Marcelo Garcia Casil October 10, 2006 09:05 AM UTC

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


AD Administrator Syncfusion Team October 10, 2006 11:35 AM UTC

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


MG Marcelo Garcia Casil October 10, 2006 12:46 PM UTC

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


MG Marcelo Garcia Casil October 10, 2006 01:41 PM UTC

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


MG Marcelo Garcia Casil October 17, 2006 09:01 AM UTC

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


MG Marcelo Garcia Casil October 25, 2006 03:15 PM UTC

Am I going to get any feedback at all??

Thanks


AD Administrator Syncfusion Team October 26, 2006 04:08 PM UTC

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.


MG Marcelo Garcia Casil November 6, 2006 04:38 PM UTC

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.


MG Marcelo Garcia Casil November 13, 2006 09:31 AM UTC

Please I need a response ASAP


AD Administrator Syncfusion Team November 13, 2006 11:03 AM UTC

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


JN Jayakumar Natarajan Syncfusion Team November 13, 2006 05:35 PM UTC

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


MG Marcelo Garcia Casil November 14, 2006 11:50 AM UTC

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


JN Jayakumar Natarajan Syncfusion Team November 14, 2006 02:46 PM UTC

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

Best regards,
Jay


MG Marcelo Garcia Casil November 14, 2006 05:01 PM UTC

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

Loader.
Live Chat Icon For mobile
Up arrow icon