I''m using 18.104.22.168 as a virtual grid. In QueryCellInfo I set e.Style.BaseStyle depending on the underlying cell.
Cells are painting correctly, but every now and then when I go into edit mode on a cell, it has the wrong style. For example, the renderer is set to the read-only style when it''s on a read-write cell.
I''ve tried doing things like adding a ForceRefresh option in a MoveTo that might be fired. I''ve also tried calling CurrentCell.ForceRefresh() at certain points. None of that seems to force the renderer to the style of the underlying cell.
Any ideas? Am I doing something wrong, or is there a way to work around the problem?
Btw, the grid is allowing some keystrokes on read-only cells. The behaviour is strange--the first keystroke disappears after the second is made, and only two keystrokes are allowed. I had to specifically set e.Cancel to true in CurrentCellStartEditing to stop read-only cells from being editable.
One more bit of info: grid[ row, col ].BaseStyle is also wrong. So it looks like *that* may be the problem, rather than the renderer.
The odd thing is that the cell is drawing correctly. So whenever/however the wrong value is being set, it happens after drawing...
ADAdministrator Syncfusion Team January 29, 2005 02:10 PM
Can you reproduce this problem in one of our samples, or can you provide a sample project that shows this problem? That way we should be able to debug the code and spot why things are not working propely.
You can send it to firstname.lastname@example.org and mention this thread in the subject line.
MLMichael LenaghanJanuary 29, 2005 02:28 PM
Actually, I think I now see what''s happening. When the user changes some non-grid info, I reset the "model" behind the virtual grid. When all of the resetting is complete, I grab the data from the server. In between, the model is marked as invalid and returns default values.
The problem is that the CurrentCell style is being set before the new model values are fetched. That means the defaults are being used, and it just so happens that the default style is the read-only one.
The correct style gets set if the cell goes into and out of edit mode. Is there some other way to force the current cell to do that? CurrentCell.Refresh() doesn''t seem to do the trick; nor does moving the current cell back to itself.
Btw: after the new model values are set the grid is invalidated--and the paiting is, in fact, using the correct style. That makes it look like CurrentCell caches something, rather than simply being a pointer to the underlying cell...?
MLMichael LenaghanJanuary 29, 2005 02:50 PM
Ok, I have a solution now. After getting the new data, and before calling Invalidate(), I call ResetVolatileData(). I was doing this at an earlier point (and I still have to, since not all changes require getting new values from the server) but I now call it again at this other point. That forces CurrentCell to re-load its cached values--in particular, the style of the current cell.
Btw, as I mentioned earlier read-only styles are allowing a few keystrokes, though what happens is quite odd.
ADAdministrator Syncfusion Team January 29, 2005 02:50 PM
The currentcell does cache information, especially if it is active. In this case, the state information is moved from the style to the renderer, and it is the renderer that controls the look of the cell while it is active.
After retrieving your new data, you might try calling grid.RefreshRange(grid.CurrentCell.RangeInfo, true) to see if that will reflect your new styleinformation.