After I do saveData() should I also execute fetchData:
frmFileIdAction.saveData();
General.fetchData(null, “frmGeneral.setValues(data[0])”);
where both frmFileIdAction and frmGeneral forms are sharing same DS General.
After I do saveData() should I also execute fetchData:
frmFileIdAction.saveData();
General.fetchData(null, “frmGeneral.setValues(data[0])”);
where both frmFileIdAction and frmGeneral forms are sharing same DS General.
It is somewhat unusual that you would have multiple forms on the same page, bound to the same DataSource, and displaying data for the same record, but if you have this situation, and you modify and save the data from one of the forms, the second form will not automatically pick up the changes from the server, you’ll have to refresh its data as well.
However you don’t need to actually perform a new fetch - DynamicForm.saveData() [documented here] takes a callback parameter. You can look at the modified data (available as a parameter to this callback function) directly rather than hitting the server again.
Would you please show an example of a callback function that I could have used to extract data from returned after savaData() XML?
My XML may look like this:
<root>
<file>
<id>1234</id>
</file>
</root>
Thanks
Sure - your call to saveData might look like this:
myForm.saveData(alert("ID:" + data[0].id));
I am trying to use in the same way you are showing.
I am getting ‘data’ is unidentified.
Sorry - I forgot to quote the callback
Try this:
myForm.saveData('alert("ID:" + data[0].id)');
Works now, thank you very much.