Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problems with FindRow method

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support
View previous topic :: View next topic  
Author Message
fx
Guest





PostPosted: Wed May 18, 2005 11:25 am    Post subject: Problems with FindRow method Reply with quote

Hi,

I'am newbie with Virtual Tree Component and I try to use FindRow(item) method and can't get it to work, except for the "root" row. The idea is to be able to expand tree down to a specific row, searched by user from different criteria.

I created a class that inherits VirtualTree and overriden method getParentForItem. In my data object bind to each row, I overriden
Equals method to control exactly how to compare two objects, thinking it could be the problem. In debugger, I see these methods are called for each parent nodes up to root one but finally the method findRow only returns null and I can't figure why.

I did not declared any bindings with ObjectBinding class, just overriden GetChildrenForRow. Hope it's enough to build the tree.

Could someone tell me if there is another "trick" to make it work or explain me how exactly the findRow method compares data objects to get the right row ?


Thanks a lot in advance,

Francois-Xavier
Back to top
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Wed May 18, 2005 11:06 pm    Post subject: Reply with quote

Whenever you override the Equals method for an object you should also override the GetHashCode method so that objects that are equal return the same hash code. If you don't then many collections will not behave as expected. This may be the problem. To track down the problem with FindRow ensure that SuppressErrorMessages property is set to false and check the VisualStudio output window after FindRow is called. If FindRow fails it prints diagnostic information to the output window.

FindRow works by constructing a "path" of objects relative to (but not including) the root row using the GetParentForItem method. It then calls the FindRow(IList path) method to actually find the row. So if you are still having problems try constructing the path yourself and call FindRow(IList path).
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
fx
Guest





PostPosted: Thu May 19, 2005 7:52 am    Post subject: Find(row) now works Reply with quote

Hi,

Thanks a lot for this advice. I overriden Find(IList) to see what's happening. Found that the "root" data object was not aded in the path... Don't know why at the time.
I manually added the root object at first in the collection and now Find() returns the right row !

Thanks a lot
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group