View previous topic :: View next topic |
Author |
Message |
WaqasK
Joined: 21 Oct 2006 Posts: 32
|
Posted: Thu Feb 21, 2008 12:56 am Post subject: Updating two trees |
|
|
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 |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Thu Feb 21, 2008 2:16 am Post subject: |
|
|
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 |
|
|
WaqasK
Joined: 21 Oct 2006 Posts: 32
|
Posted: Thu Feb 21, 2008 9:23 pm Post subject: |
|
|
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 |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Thu Feb 21, 2008 9:29 pm Post subject: |
|
|
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 |
|
|
WaqasK
Joined: 21 Oct 2006 Posts: 32
|
Posted: Thu Feb 21, 2008 10:42 pm Post subject: |
|
|
yep, calling the connection.Refreshrecordsets() worked.
Great, thank you! |
|
Back to top |
|
|
|