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 

Updating two trees

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



Joined: 21 Oct 2006
Posts: 32

PostPosted: Thu Feb 21, 2008 12:56 am    Post subject: Updating two trees Reply with quote

Hi,

I have two trees. The first using dataset binding and the second object binding. Both trees get their data from the same source (a database) and both show the same data.

To the dataset tree I've added a celleditor and a tree.SetCellValue event to update the tree when it is edited. I have also added code to update the value in the underlying database. Now, what I'd like to do is automatically update the the object binding tree once the data in the source is updated. How can I do this?

Thanks,
Waqas
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Thu Feb 21, 2008 2:16 am    Post subject: Reply with quote

Quote:
Now, what I'd like to do is automatically update the the object binding tree once the data in the source is updated. How can I do this?


I'm not sure what you mean by automatically. You can call the VirtualTree.UpdateRowData() method to update the second tree if data has changed (or UpdateRows if the tree structure has changed).

What type of data source is the second tree bound to (using Object Binding)?
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
WaqasK



Joined: 21 Oct 2006
Posts: 32

PostPosted: Thu Feb 21, 2008 9:23 pm    Post subject: Reply with quote

I've tried using the UpdateRowData() method but it doesn't seem to update my tree. Thee is something strange about the behaviour of the tree after I update the first one. That is, when I call UpdateRowData() the tree rows will not be updated but if I change the current sort by clicking on one of the columns the rows will update.

I'm using a mysql database to store the underlying data for the Object binded tree and also for the dataset tree. So when the first dataset tree is updated, my app also updates the data in mysql. Since both databases are using the same database, I would have expected the object binding tree to update when I called UpdateRowData(). But it does not. Is this because the row bindings on the object tree need to be updated first? If so how could I do this? Will it require re-loading the entire dataset?
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Thu Feb 21, 2008 9:29 pm    Post subject: Reply with quote

How are you creating the data that the second (object bound) tree is bound to - are you using Virtual Data Objects? If so you would need to call VirtualRecordset.Refresh to force the recordset that contains the data to be refreshed from the database (or VirtualConnection.Refresh to refresh all open recordsets).
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
WaqasK



Joined: 21 Oct 2006
Posts: 32

PostPosted: Thu Feb 21, 2008 10:42 pm    Post subject: Reply with quote

yep, calling the connection.Refreshrecordsets() worked.

Great, thank you!
Back to top
View user's profile Send private message
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