Hi all,I am currently facing a strange problem with the WinGrid.It is a standard WinGrid, bound to an object datasource (List<item>).I added an UnboundColumn to display a "light" icon that indicates its status (red, green).On InitializeRow the calculation is done and a predefined (for reuse) Appearance is assigned to the cell (unbound column).Now imagine the following rows (Id, IndicatorImage):1 green2 green3 red4 red
now if I remove the data entry from the datasource that contains Id = 2 I assumed to have the following rows:1 green3 red4 red
Unfortunately I get this:1 green3 green4 red
It seems that the indicator image stays the same for the rows (the bottom one is removed though)
Any hint is kindly appreciated,best regardsAndy
Hi Andy,
Yeah, that's pretty much what I thought. There has to be something in GetCountFromItem that is getting the wrong data at that particular point in time.
Hi Mike,I made a sample to see if it is related to the grid, but I wasn't able to reproduce it.Even without updating the grid and refreshing the rows it works fine, it takes a while but it works fine...
If you are interested I can send you the sample.
Anyway, your solution for fixing the problem works fine and I'll stick to it. Adding buffers was easy, so it performs pretty fast now.
Thanks a lot for your help Mike, I really appreciate your great support!
have a great time,cheersAndy
Sure, if it looks like this is a problem with the grid, then please post a sample duplicating the issue and we will be happy to check it out.
I am not quite sure if I get this correctly.
The GetCountFromItem uses a different datasource that the grid.
The grid is actually bound to a List<item> that is disconnected from the database.So removing the item from the List<item> via a call to the Lists "_list.Remove(item)" function just removes the item and does not involve any database operations at this point.
Funny was that the order of the IndicatorImage stays the same if you look at it from the top. So if I removed an item from the middle the IndicatorImages stay the same from the top. It looks like that all rows after the deleted one just move one up and the bottom one is removed completely, leaving the order of indicator images intact...
Like if you just empty the row of the deleted item (only the cells that do not show the image). Then move all lower entries (only cells without image) one up which results in the bottom row only containing the image and empty cells. Then remove the bottom row...
I am going to do a test tomorrow with a simple structure and check if this is happening there too. I will send you the project if it turns out to behave the same, would that be ok? If it doesn't behave like this the problem is in my structure.
cheersAndy
Yes, I see from the code here that you are passing the ListObject into the GetCountFromItem method. It looks to me like the ListObject of the row is correct - it has to be or the grid would not be showing the correct value in the first column. But GetCountFromItem must be accessing data from the data source that hasn't caught up to the delete operation, yet.