I did some tests with databinding between DataGrids, TextInput, 2nd DataGrid, and CheckBoxes. Here is the scenario:
- HTTPService1 gets XML input
- DataGrid1 is bound... dataProvider = "{HTTPService1.lastResult.items.item}"
- TextInput1 is bound to DataGrid1 via text="{DataGrid1.selectedItem.anyTextField}"
- DataGrid2 is bound to DataGrid1 via dataProvider = "{DataGrid1.selectedItem.anySubList.item}"
- One field in DataGrid2 is CheckBox1 (databound to the selected field)
Somewhere, somewhen on this board I read that databinding is unidirectional; meaning a dataprovider source will not automatically update when a databound target changes. This is true e.g. for TextInput controls. To get your edited data back, you have to
- Update the listitem via change="DataGrid1.selectedItem.anyTextField=TextInput1.text"
- ...and if it happens to be the last row, you also have to call DataGrid1.invalidateList(), otherwise the display will not update (the data is updated). This is curious...
I also noted that "manual updating" is not necessary between the DataGrids. In other words, if you change any data in DataGrid2 (e.g. via editable="true"), the datasource seems to remember. Whenever I changed selection in DataGrid1, DataGrid2 would show the related sub records, including any changes to data in DataGrid2. To verify, I made a button to show the XML source, and voila...
- Change the HTTPService1.resultFormat to "e4x"
- Then e.g. use Alert.show(HTTPService1.lastResult.toString(),'Message')
Sure enough, that XML source is updated...very bi-directional I think. Great. Now why is it again that TextInput does not do that? God knows, ... some flex god on this list maybe ;-)
I also noted another strange behaviour: when using "e4x" the CheckBoxes were not populated anymore. Yes, I did take into account that the root layer in e4x XML is ignored, but maybe there is more to this result format. (actually I am not sure whether I will be working with e4x, I just used it to Alert.show() the XML source....
Any ideas, help, comments always appreciated.
-Iko
__._,_.___
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
| Software development tool | Software development | Software development services |
| Home design software | Software development company |
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
__,_._,___

