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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Hiding Multiple Rows in a Grid

Thread ID:

Created:

Updated:

Platform:

Replies:

106437 Jan 7,2013 03:54 PM UTC Jan 14,2013 11:40 AM UTC WinForms 8
loading
Tags: GridControl
Bryan Roberts
Asked On January 7, 2013 03:54 PM UTC

Good Morning,

I am attempting to hide multiple rows in a grid and am experiencing a lot of performance issues when doing this. I am trying to hide all the rows in a grid (over 1000) and then add just a certain few when the grid refreshes. Currently I am using Syncfusion.Windows.Forms.Grid.GridControl.HideRows.SetRange(startrow, endrow, true); 
This code seems to take a long time to hide all the rows in the grid and I was wondering if there is a known issue with this or a faster way to implement this idea.

Thanks in advance,
Bryan

Vinish Kumar K [Syncfusion]
Replied On January 8, 2013 06:48 AM UTC

Hi Bryan Roberts,

 

Thank you for your interest in Syncfusion products.

 

Query

Hide a multiple rows quickly.

You can use the RowHeights.SetRange instead of HideRows.SetRange to hide a rows. This function also used to hide the rows based on the range.

 

Please refer the following code.

 

grid.RowHeights.SetRange(0, INITIAL_ROW_COUNT,ihidden_row,true);// hidden_rows, true);

 

And use ResetRange property to increase the performance of the grid. We can improve the performance by using the .RowHeights.SetRange and ResetRanges method.

 

grid.RowHeights.ResetRange(0, INITIAL_ROW_COUNT);

 

Please refer the attached sample file for further reference.

 

 

Please let me know if you have further concerns.

 

Regards,

Vinish.



HideGridRows_56982deb.zip

Bryan Roberts
Replied On January 8, 2013 04:15 PM UTC

Vinish,

Thank you for your quick response regarding this issue. Unfortunately I am having a little bit if difficulty implementing your solution. I am assuming this is due to a lack of understanding if what you are saying on my part. Here is what I have done for my first case where I am hiding all the rows in the grid. With your suggestion I have generated new code to implement this idea: 

                int rowCount = _gridPDD.RowCount;
                int rowIndex;
                int[] hiddenRows = new int[rowCount];
 
                for (rowIndex = 0; rowIndex < rowCount; rowIndex++)
                {
                    hiddenRows[rowIndex] = 0;
                }
 
                _gridPDD.RowHeights.SetRange(2, rowCount, hiddenRows, true);
Where _gridPDD is GridControl.

With this code I am getting no results. The pins (all of the pins) I am attempting to
hide are not hiding and are still showing in my grid.

Thank you,
Bryan R.

Bryan Roberts
Replied On January 8, 2013 05:11 PM UTC

Update:

I got this code to actually do what the feature is expecting and hide all the pins in the gird, but the performance for this is even slower than the HideRows method. The hide rows method with 33,000 rows takes 17.22 seconds where this way takes 18.26 seconds and then I found that it crashes when trying to do anything before it is completely finished which can take up to approximately a minute. Let me know if you have any other suggestions.

Thanks,
Bryan

Vinish Kumar K [Syncfusion]
Replied On January 9, 2013 01:52 PM UTC

Hi Bryan,

 

Thanks for your update.

 

Query

Row hide performance.

We have analyzed the sample which is provided by us on last update. The performance of row hide is very fast with our last suggested solution.

 

Please let me know did you have used the ResetRange  property in your application. Please refer the following code.

 

 grid.RowHeights.ResetRange(0, INITIAL_ROW_COUNT);

 

 

Please let me know if you have further concerns.

 

Regards,

Vinish.


Bryan Roberts
Replied On January 9, 2013 02:36 PM UTC

I agree the performance for the supplied feature is fast but my grids include 30,000+ rows and with this the SetHeight() and reset range can take up to a minute to "hide" all the rows in my grid. From my understanding the ResetRange() is just used to "show" all the rows that are in the grid after we hide them, my issue is the time it takes to actually "hide" the rows. Showing the rows takes just about a second which is why I find this strange. 

Thanks again,
Bryan

Bryan Roberts
Replied On January 10, 2013 03:01 PM UTC

Update:

Good Morning,

When I tried to "hide" the rows with RowHeights.SetRange() it takes about 20 seconds to "hide" 33,000 rows. I will be working with grids that will have rows of up to one million. I did however find a way to hide the rows using the Query RowHeight even handler although for the 33,000 rows this method is still taking a little over 10 seconds and will take a lot longer with more rows. I have attached my code that I am using now and am wondering if there is anything I can add to improve the performance of this feature.

Thanks,
Bryan


examplecode_93f97c25.zip

Bryan Roberts
Replied On January 10, 2013 06:37 PM UTC

Also with the example code you attached I was able to modify the grid to make it 100,000 rows and we are looking at about 7 seconds for it to hide all the rows in the grid. Seems there should be a faster way. I know you can do Visible = false. I was wondering with that if when you do that you can make individual rows visible in the grid. 

Thanks again,
Bryan R.

Vinish Kumar K [Syncfusion]
Replied On January 14, 2013 11:40 AM UTC

Hi Bryan,

 

Thank you for your update.

 

We regret for the inconvenience caused with delay. We have analyzed code and you update. Based on your update you have used the row height to zero in events. Some  event may fires may tomes while the grid is refreshed. But in your update you didn’t mentioned that and the sample code have some filters also.

 

To increase the performance you can avoid the grid refresh in may place. If you have provide the sample application (whole CS project) or provide any sample application with all your requirement to reproduce the issue in our end we can able to solve or used to identified the original issue in the application. Please provide the sample code as soon as possible.

 

We will wait for your replay.

 

Regards,

Vinish.

 


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

;