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

Move Column

Stefan Thanks for the anwser. Now if the user moves a column, what happens to the data ? Do i have to repopulate all the grid ? Is it different if i use the volatiledata inside or outside the grid ? Also what happens when new data comes in. How to optimize the refresh. I have let''s say 5 cells to update. Do i have to refresh the whole grid ? And regarding the column order how do i handle this. Thanks again as it is unclear to me Killy

3 Replies

AD Administrator Syncfusion Team February 9, 2005 05:53 PM UTC

Killi, when you move a column it is best to just clear out the cache and let it be rebuild next time indexer is called. The underlying data of yours - that depends on how that is implemented. You can either move the columns around or rebuild that data object. For example if underlying data is a GridData object, then when you call MoveCols it will loop through all rows and reshuffle columns in each row. Please not also that all that NonVirtualDataCache (as used in the RefreshGrid example) does is hook up a GridStyleInfoIdentity with the store that it gets from your Data object and then gives the grid a GridStyleInfo object to work with. The GridStyleInfo is just a very thin wrapper around the GridStyleInfoStore. All it does is provide methods like BackColor, Font etc. that then call GridStyleInfoStore.GetValue(GridStyleInfoStore.FontProperty) etc. In addition it owns an identity object. The StyleInfoStore object itself is not copied. Only a reference to it is copied. Using volatild data cache outside the grid does not make sense. When you have 5 cells to update, you could provide a routine from GridNonVirtualDataCache that resets those objects to in _dataCache. See GridStyleInfo this[int rowIndex, int colIndex]. If _dataCache[r, c] is null the data are reloaded and cached. Stefan >Stefan > >Thanks for the anwser. >Now if the user moves a column, what happens to the data ? Do i have to repopulate all the grid ? > >Is it different if i use the volatiledata inside or outside the grid ? > >Also what happens when new data comes in. How to optimize the refresh. I have let''s say 5 cells to update. Do i have to refresh the whole grid ? >And regarding the column order how do i handle this. > >Thanks again as it is unclear to me >Killy


AD Administrator Syncfusion Team February 9, 2005 06:16 PM UTC

Stefan I just began to understand that the NonVirtualDataCache is a temporary in memory image of the grid which i can flush by calling ResetVolatileData. It holds not only the text but also the style. Althought i have the feeling that your last statement is important to me, could you be more explicit: "When you have 5 cells to update, you could provide a routine from GridNonVirtualDataCache that resets those objects to in _dataCache. See GridStyleInfo this[int rowIndex, int colIndex]. If _dataCache[r, c] is null the data are reloaded and cached." When i reset the data i have nothing there... When i set _dataCache[r, c]=null, where the data is taken from ? Do i have to call InvalidateRegion ? With 5 cells scattered in the grid, what kind of graphical refresh should i call ? Thanks Killy


AD Administrator Syncfusion Team February 9, 2005 07:21 PM UTC

Killy, >"When you have 5 cells to update, you could provide a routine from GridNonVirtualDataCache that resets those objects to in _dataCache. See GridStyleInfo this[int rowIndex, int colIndex]. If _dataCache[r, c] is null the data are reloaded and cached." > >When i reset the data i have nothing there... >When i set _dataCache[r, c]=null, where the data is taken from ? You are right. Resetting the data won''t do you much. What you need to do is set the CellValue on the style object for those indivudal cells. WRT to what to when you have 5 cells scattered in the grid, this is hard to give a one fits all answer. You do have two choices: Loop through all 5 cells and invalidate each cell individually and call Update() so that each cell is painted by itsself or Invalidate the whole grid. You would have to do performance testing to find out which works better in your case. It depends how large the grid is and how many cells are visible. One other thing you could also try would be to paint those cells directly, but I actually never have done that. If you look at the method I provided today in incident http://www.syncfusion.com/support/forums/message.aspx?MessageID=24710, that could be something to try for such a case where you want to repaint scattered cells and leave all other content the way it is. Stefan

Loader.
Up arrow icon