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: changing column and row count in runtime.

Thread ID:

Created:

Updated:

Platform:

Replies:

17881 Aug 18,2004 10:55 PM Aug 19,2004 02:09 AM Windows Forms 3
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On August 18, 2004 10:55 PM

Hello ! I have GridControl in virtual mode. Sometimes I should changing column count. Count of displaying columns changing in Form, that appears above grid. After I decrease column count and press OK on form, the form dissapear and grid refreshes those fields, that was below the form. After that, QueryCellInfo request data for columns, that already not in available range of columns (decreased). So, how can I synchronize internal switching of column count or row count with grid drawing process ? Thanks.

Administrator [Syncfusion]
Replied On August 19, 2004 01:08 AM

Normally, in a pure virtual grid you never set grid.RowCount or grid.COlCount. Instead, you handle QueryRowCount and QueryColCount and provide the values there by setting e.Size = ??? and e.Handled = true. The values you set come directly from your datasource. Doing it this way allows the grid to work with your data without allocating space for rows and columns. If you explicitly set grid.RowCount and Grid.ColCOunt, the grid will allocate space. Now this ok if you are aware of it, and it suits your needs. But if your datasource is huge, you would probably want to avoid it. A lot of times, people will handle QueryRowCount and explicitly set grid.ColCount as the columns may be few and fixed whereas the row count may be dynamic and vary significantly. Anyway, to get changes in the number of rows or columns in your datasource to display properly, you can try calling grid.ResetVolatileData after you have changed them. If that is not sufficient, you can try calling grid.Refresh instead.

Administrator [Syncfusion]
Replied On August 19, 2004 01:22 AM

Of course I operate with QueryColCount and QueryRowCount, but the problem is: I should somehow handle QueryCellInfo for column 23, after I reduce inner variable colcount from 23 to 15 and call grid.Refresh(). Cause I think Paint comes asinchronously to the grid. And it comes after I close settings form and before I call refresh :(

Administrator [Syncfusion]
Replied On August 19, 2004 02:09 AM

Are you change the column count on a different thread from thh the GridControl''s thread. If so, you should wrap teh virtual events in grid.InvokeRequired checks, and then do grid.Invoke if needed to call teh handler on the grid''s thread. If you are not using separate threads, I am not sure why this problem would be happening. One thing you could try is that before you change 23 to 15, your datasource could raise an event that informs listeners that it is about to lower the column count. Then the grid could listen for this event, and try to handle any work it may need to do (like setting LeftColIndex so only ''good'' columns are visible, and maybe calling grid.CurrentCellMove to position the current cell away for a column that is no longer available after the event.)

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.

;