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

Only off-screen rows are updated when bound IList changes

I have a group grid that binds to a IList. When the IList changes, the rows that already displayed on the screen are not updated. However when I scroll down the list I can see that the rows that were not visible on the screen ARE updated! I tried to set TableDirty flag but that didn't help.

12 Replies

HA Haishi July 6, 2007 05:08 PM UTC

Forgot to mention that when I select any row that doesn't have the update, the updated field shows up. When the row is deselected the value dispears.

>I have a group grid that binds to a IList. When the IList changes, the rows that already displayed on the screen are not updated. However when I scroll down the list I can see that the rows that were not visible on the screen ARE updated! I tried to set TableDirty flag but that didn't help.


HA haneefm Syncfusion Team July 6, 2007 06:59 PM UTC

Hi Stanley,

An arbitrary IBindingList DataSource does not fire any events to notify any changes. In such cases, you would have to explicitly call grid.Refresh and grid.ReIntialize method after the arraylist changes. Below are the codes:

this.groupingGrid1.BeginUpdate();

CustomerCollection cc = this.groupingGrid1.DataSource as CustomerCollection ;
cc.Add(new Customer("22222333"));
this.groupingGrid1.EndUpdate(true);

this.groupingGrid1.Reinitialize();
this.groupingGrid1.Refresh();

Best regards,
Haneef.


HA Haishi July 6, 2007 07:35 PM UTC

Hi Haneef:

Thank you for your suggestion but it did not solve my problem. This is my code
this.grid.EndUpdate(true);
<> this.grid.Reinitialize();
this.grid.Refresh();

But it didn't work. Also, what you said doesn't explain why I see half the rows (initially off screen) with the value but the other half (that are originally displayed on screen), and why the value appears when i select a row and dispears when the row is deselected. Btw, my class (that inherits IBindingList) does raise ListChanged event and it has been working fine with normal windows grid controls.

>Hi Stanley,

An arbitrary IBindingList DataSource does not fire any events to notify any changes. In such cases, you would have to explicitly call grid.Refresh and grid.ReIntialize method after the arraylist changes. Below are the codes:

this.groupingGrid1.BeginUpdate();

CustomerCollection cc = this.groupingGrid1.DataSource as CustomerCollection ;
cc.Add(new Customer("22222333"));
this.groupingGrid1.EndUpdate(true);

this.groupingGrid1.Reinitialize();
this.groupingGrid1.Refresh();

Best regards,
Haneef.


HA Haishi July 6, 2007 07:37 PM UTC

Updated code:

this.grid.BeginUpdate();
//Update List Here
this.grid.EndUpdate(true);
this.grid.Reinitialize();
this.grid.Refresh();


>Hi Haneef:

Thank you for your suggestion but it did not solve my problem. This is my code
this.grid.EndUpdate(true);
<> this.grid.Reinitialize();
this.grid.Refresh();

But it didn't work. Also, what you said doesn't explain why I see half the rows (initially off screen) with the value but the other half (that are originally displayed on screen), and why the value appears when i select a row and dispears when the row is deselected. Btw, my class (that inherits IBindingList) does raise ListChanged event and it has been working fine with normal windows grid controls.

>Hi Stanley,

An arbitrary IBindingList DataSource does not fire any events to notify any changes. In such cases, you would have to explicitly call grid.Refresh and grid.ReIntialize method after the arraylist changes. Below are the codes:

this.groupingGrid1.BeginUpdate();

CustomerCollection cc = this.groupingGrid1.DataSource as CustomerCollection ;
cc.Add(new Customer("22222333"));
this.groupingGrid1.EndUpdate(true);

this.groupingGrid1.Reinitialize();
this.groupingGrid1.Refresh();

Best regards,
Haneef.



HA Haishi July 6, 2007 09:17 PM UTC

Any more ideas? I wonder if there's some caching going on here, however I didn't find where to control the caching behaviors?


>Updated code:

this.grid.BeginUpdate();
//Update List Here
this.grid.EndUpdate(true);
this.grid.Reinitialize();
this.grid.Refresh();


>Hi Haneef:

Thank you for your suggestion but it did not solve my problem. This is my code
this.grid.EndUpdate(true);
<> this.grid.Reinitialize();
this.grid.Refresh();

But it didn't work. Also, what you said doesn't explain why I see half the rows (initially off screen) with the value but the other half (that are originally displayed on screen), and why the value appears when i select a row and dispears when the row is deselected. Btw, my class (that inherits IBindingList) does raise ListChanged event and it has been working fine with normal windows grid controls.

>Hi Stanley,

An arbitrary IBindingList DataSource does not fire any events to notify any changes. In such cases, you would have to explicitly call grid.Refresh and grid.ReIntialize method after the arraylist changes. Below are the codes:

this.groupingGrid1.BeginUpdate();

CustomerCollection cc = this.groupingGrid1.DataSource as CustomerCollection ;
cc.Add(new Customer("22222333"));
this.groupingGrid1.EndUpdate(true);

this.groupingGrid1.Reinitialize();
this.groupingGrid1.Refresh();

Best regards,
Haneef.




HA haneefm Syncfusion Team July 6, 2007 09:49 PM UTC

Hi Stanley,

Thank you for posting your query to us.

I tried to reproduce this problem using this sample.

GGC_DataBinding.zip

But, I could not get this problem. Maybe I am not following the steps that you are doing. Is it possible for you to provide more information on this problem? This will help me to analyse the issue further.

Please do let me know if you have any technical questions or I can be of any other assistance. I will be glad to assist you.

Best regards,
Haneef


HA Haishi July 6, 2007 10:52 PM UTC

Haneef:

Thank you for your sample code. To reproduce the problem, replace the line in button1_click, where you add "Stanley" record to an update like:

cc[0].FirstName = "ABC";

Then you'll see only when the first record is selected, the FirstName column shows "ABC", otherwise it shows the old value (in my case the old value is empty string).

Regards,
Stanley

>Hi Stanley,

Thank you for posting your query to us.

I tried to reproduce this problem using this sample.

GGC_DataBinding.zip

But, I could not get this problem. Maybe I am not following the steps that you are doing. Is it possible for you to provide more information on this problem? This will help me to analyse the issue further.

Please do let me know if you have any technical questions or I can be of any other assistance. I will be glad to assist you.

Best regards,
Haneef


HA Haishi July 6, 2007 11:09 PM UTC

Haneef:

I removed some text to be clear

Thank you for your sample code. To reproduce the problem, replace the line in button1_click, where you add "Stanley" record to an update like:

cc[0].FirstName = "ABC";

Then you'll see only when the first record is selected, the FirstName column shows "ABC", otherwise it shows the old value (in my case the old value is empty string).

I also tried

this.gridGroupingControl1.Table.Records[0].SetValue("FirstName", "ABC");

this will solve the above problem, however there are two downsides:

1) when i update the underlying list i have no reference to which Record the list item maps to

2) this is rather strange because as the data source is "bound" to the grid i shouldn't need to do this.

Probably you have better ways that I don't know of? Thank you!

Stanley


HA haneefm Syncfusion Team July 7, 2007 12:35 AM UTC

Hi Stanley,

We have no reports of this refreshing problem, and have not seen it here. Attached video clip showing this fuctionality on my system which has 5.1 installed. Below is a video clip.

RefreshCellValuevideo.zip

Exactly what version of Windows XP are you using?

Are you only installing Essential Grid or are you installing Essential Studio? Are you installing binaries only, or the source code version?

What version of the .NET framework and VS are you using?

Did you see any errors during the installation of Essential Grid?

Best regrads
Haneef


HA Haishi July 7, 2007 05:30 AM UTC

Hmm... it does look fine in the video

I'm using XP SP2, Visual Studio 2005 Team Edition. My Syncfusion version is 5.1.0.51 binary. No error during installation.


HA haneefm Syncfusion Team July 9, 2007 06:18 PM UTC

Hi Stanley,

You can try implementing INotifyPropertyChanged interface similar to this sample:

\Grid.Grouping.Windows\Samples\2.0\CustomCollections\IBindingList

So that grid gets notified when a property in the collection’s object has been changed.

The IBindingList browser sample demonstrates the implementation of the IBindingList for the ArrayList that is used internally and also shows how to bind this list to a grouping grid control. Implementing the IBindingList will require the implementation of all the members of the IBindingList, IList, ICollection and IEnumerable interfaces.

Benefits:
The benefits of using IBindingList include the support for change notifications when the list is modified. It does have a ListChanged event which will be fired upon any data changes. If the collection supports changes, it should also support firing a ListChanged event when the collection changes. To indicate that, it should return true from the SupportsChangeNotification property. Hence when items are added or removed from the collection, the grouping grid will be notified of these chagnes and will update itself automatically.

Best regards,
Haneef


HA Haishi July 10, 2007 05:57 PM UTC

OK I found the problem. In my previous code i used wrong index when raising ListChanged event ....
Thank you for your help.

Loader.
Live Chat Icon For mobile
Up arrow icon