View previous topic :: View next topic |
Author |
Message |
amsimmon
Joined: 31 Mar 2006 Posts: 13
|
Posted: Thu Aug 10, 2006 7:01 pm Post subject: Bug in DataViewList |
|
|
DataViewList in Version 2.5.6 no longer supports the CopyTo method of the ICollection interface. It was supported in 2.5.3.
Also, in the starting declaration of _index in the Enumerator class and in the IEnumerator.Reset method the _index is set to 0 which isn't correct.
According to the definition of that interface on MSDN:
Reset Sets the enumerator to its initial position, which is before the first element in the collection.
The code here sets the enumerator to the first element instead of before the first element. The effect of this is that
Code: |
foreach(DataRow row in dataViewList)
|
will only operate on indices 1 through length -1, skipping 0. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Thu Aug 10, 2006 10:53 pm Post subject: |
|
|
The DataViewList class provides a wrapper that allows Virtual Tree to bind to the underlying DataRow objects referenced by a DataView. It is really only intended for use by Virtual Tree.
Prior to 2.5.4 the DataViewList returned DataRowView objects (the same as a DataView) and so most of the IList methods could be implemented as simple call throughs to the wrapped DataView class. It's main function was to implement IndexOf and Contains methods that operated based on the underlying DataRow.
In 2.5.4 and later versions Virtual Tree now deals directly with DataRow objects (instead of DataRowView objects). This greatly simplifies the programming model. It meant however substantial changes to DataViewList. It now returns the underlying DataRow objects for the DataView - and so IList methods cannot be implemented as simple callthroughs anymore. IList methods which are not required by Virtual Tree are not implemented.
Virtual Tree does not actually use the enumerator - so it is possible that the Reset definition is a bug - we will check this out.
You could implement the CopyTo method yourself by iterating over the list (though possibly not using the enumerator!)
Why do you need to use the DataViewList class anyway? This might help us understand your issue a little better. _________________ Infralution Support |
|
Back to top |
|
|
amsimmon
Joined: 31 Mar 2006 Posts: 13
|
Posted: Fri Aug 11, 2006 8:11 pm Post subject: |
|
|
It's not a critical bug for me. I worked around it by using a for loop before I posted the message. I just wanted to let you know.
I used DataViewList in my GetChildren event because it is returned from RowBinding.GetChildrenForRow. I wanted to add another group of children rows along with the existing children under some nodes so I grabbed the existing children using that method and added them to a collection with my new children DataRow's and set the complete collection as e.Children. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Fri Aug 11, 2006 11:42 pm Post subject: |
|
|
OK - we will fix the enumerator issue. We won't implement the CopyTo interface because that is fairly easy for you to do yourself as you already are. _________________ Infralution Support |
|
Back to top |
|
|
|