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.

ViewLayout.VisibleCellsRange problem

Thread ID:

Created:

Updated:

Platform:

Replies:

48506 Aug 29,2006 03:59 PM Sep 6,2006 01:21 PM Windows Forms 7
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On August 29, 2006 03:59 PM

Attached is a sample app that reproduces the problem. We''re using version 3.3 of the grid and we''re locked to that version for the moment.

The problem basically happens as follows: Create a virtual grid with 1 row and make that row hidden. Then change the row count to enough rows to show a scrollbar (50 rows in the example), and call ResetVolatileData(). Now, if you change the row count back to 1 with that row still hidden, ViewLayout.VisibleCellsRange becomes an empty range, even though it wasn''t an empty range when initially displayed.

It''s scrollbar related and only happens if you add enough rows so that the scrollbar shows up. If you change it to say, 3 rows and then back to 1 row, the test app will continue go back to showing the ViewLayout.VisibleCellsRange as "R1C1:R1C4".

The Empty range is causing us a lot of problems because we do some custom drawing outside the actual grid based on the ViewLayout.

If this requires source code change in the grid, that''s fine. Simply point me in the right direction.

Thanks.

TwoColGridSamp0.zip

Administrator [Syncfusion]
Replied On August 30, 2006 06:09 AM

Hi Pete,

Instead of hidding a row, you can try to set a RowHeight to ZERO in the QueryRowHeight event. Please refer the modified sample for more details.

private void Model_QueryRowHeight(object sender, GridRowColSizeEventArgs e)
{
if(e.Index == 1)
{
e.Size = 0;
e.Handled = true;
}
}
Here is a sample.
http://www.syncfusion.com/Support/user/uploads/TwoColGridSamp_32b37da9.zip

Let me know if this helps.
Thanks,
Haneef

Administrator [Syncfusion]
Replied On August 30, 2006 08:48 AM

Haneef,

Setting the row height to 0 is not an option at this point. Our code uses hidden columns and rows extensively. Unfortunately the problem only came up recently.

Even if I could change all the code that depends on the use of hidden rows and column, there''s the issue that we hide and unhide rows and column which means we need to know the original height/width when we want to unhide. That''s lost of we change the actual height/width to 0.

The start of the problem appears to be this line in GridViewLayout.Initialize():
rgVisible = GridRangeInfo.InternalCells(grid.GetRow(nfr+1), grid.GetCol(nfc+1), nLastRow, nLastCol);

gridRow.GetRow(nfr+1) is returning 2 while nLastRow is 1. This leads to an empty range.

I considered change grid.GetRow(nfr+1) to Math.Min(grid.GetRow(nfr+1), nLastRow) and doing something similar with the column, but that''s not really a clean fix.

The real underlying problem seems to be that GridScroll is thinking that the grid is scrolled to the 2nd row even though there is no second row anymore. So it''s like GridScroll isn''t getting properly reset.

I''d really like to fix the real problem instead of hack the VisibleCellsRange, but I''m just not sure how to do that properly.

Pete

Administrator [Syncfusion]
Replied On August 31, 2006 06:17 AM

Hi Pete,

Sorry for the inconvenience caused.

We are looking into this issue and get back to you very soon.

Thanks for your patience.
Regards,
Haneef

Administrator [Syncfusion]
Replied On August 31, 2006 01:54 PM

Thanks. I look forward to hearing from you.

Administrator [Syncfusion]
Replied On September 5, 2006 12:03 PM

Has any progress been made on this issue? This is causing a handful off issues in our system that we can''t resolve until this is taken care of.

Thanks.

Pete

Administrator [Syncfusion]
Replied On September 5, 2006 01:40 PM

Hi Pete Davis,

I am sorry for the delay in getting back to you. We are able to see the issue and we have forwarded it to the development team and will get back to you with in a couple of days. Thanks for your patience.

Thanks,
Calvin.

Administrator [Syncfusion]
Replied On September 6, 2006 01:21 PM

Hi Pete Davis,

Thanks a lot for your patience.
We recommend that you could have your own implementation of the VisibleCellsRange method (as mentioned below) which can for now be simply a wrapper that then calls ViewLayout.VisibleCellsRange, and then you can call this method instead of calling ViewLayout.VisibleCellsRange.

The reason for this is that, the fact that the correct behavior for ViewLayout.VisibleCellsRange actually would be to return an empty range and not the non-empty range since no cells are visible. We leave that for now as it is since we do not want to break any application that possibly depend on it (like yours …), but that might change in future versions if the behavior causes problems somewhere else.


In GridControlBase.cs, search for the method SetTopRow

Replace this old line
rowIndex = Math.Max(nfr+1, rowIndex);
With this new code.
rowIndex = Math.Min(Model.RowCount, Math.Max(nfr+1, rowIndex));


Next search for the method SetLeftCol

Replace this old line
colIndex = Math.Max(colIndex, nfr+1);
With this new code.
colIndex = Math.Min(Model.ColCount, Math.Max(colIndex, nfr+1));


Warm Regards,
Calvin.

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.

;