I have read alot of questions and answers about XamDataGrid refreshing. But I haven´t found andwer for my problem with data refreshing.
I have XamDataGrid binded to DataView /*dataset*/ with hierarchical datatables. New records (added by user) are saved immediately to the database.
If user adds new record (i.e. called X) to parrent table, records is created in dataset with temporary ID value, which is chanded to real value after saving to the database. Up to here is everythink ok. But problem comes in case the adding new child record (i.e. called Y) to parrent record (X) , becose DataRecord of parrent (X) doesn´t have refresh ID column and XamDatagrid try to add record Y with old temporary value in foreignkey column.
I know I can reset it by "reset" datasource (set to null and than set datasource again), but there is problem, becouse all collapsed datarecords in hierachy are then uncollased. :o( it is very stressful for user if he wants to continue in adding next child rows. (user has to find required row, collapses it and then can continue).
Is there some solution?
Kind regards,
Martin
Hello Alex,
OK. It is possible.
But how can I keep track of expanded records. (I can not keep expanded records, because they are replaced by new records after rebinding, IDs of records are changed to real database ID :o( ). There is nothing to keep.. Any Idea?
Yes I thought what Andor said.
Hi Alex,
Our scenario, what zhuwei mentioned previously is slightly different.
XamDataGrid doesn't handle changes in the key of the relation in case of a hierarchical view. In our scenario we have a 2-part key: ID and Version. In case of an update, version number increases both in child and parent rows keeping the relation in sync. XamDataGrid breaks the relation and child row won't be connected to the parent anymore.
However changing version number of the child back to the original value restores the relationship incorrectly. (Underlying DataSet/DataView handles this scenario correctly.)
I can put a small sample app together if needed.
cheers,Andor
Hello Martin,
I believe in this scenario rebinding cannot be avoided, because you have to make sure that you are working with the correct data each time a record is added. Your problem is that when you rebind, all the records are collapsed (not expanded), right? If so, you can keep track of your current record and its nested depth and when you rebind expand the records up to that point?
Is this acceptable in your scenario?
facing the same issue here. would really appreciate an infragistics response, hopefully with a solution :)