pcawdron
01-02-2007, 03:26 AM
How do you get the data in a grid to update the dataset source file?
I hate wasting people's time, so I've browsed the vast majority of the 55 odd forum entries on how to update a <grid> trying to figure this out. I also checked the contactlist, xmldata examples and calendar demo looking for something similar with a grid, but couldn't find anything.
There doesn't seem to be any examples that use the updateData() method described in chapter 35 paragraph 3.1 of the reference docs. I've tried it out as best I understand it, but it doesn't seem to work. Consider the following...
<canvas>
<dataset name="myDataset" request="true" src="data.xml"/>
<simplelayout axis="y" spacing="10"/>
<grid id="myGrid" datapath="myDataset:/mydata/structure" contentdatapath="sample"/>
<button onclick="myGrid.datapath.updateData();myGrid.datapath.seria lize();">Update Data</button>
</canvas>
data.xml
_______
<mydata>
<structure>
<sample counter="1" description="update this"/>
<sample counter="2" description="update that"/>
</structure>
</mydata>
You can view the dataset and make changes but they're not updated in the XML file.
Could anyone point me to some more literature on how this works?
Ideally, I'd prefer to send partial updates like...
<canvas>
<dataset name="myDataset" request="true" src="data.xml"/>
<simplelayout axis="y" spacing="10"/>
<grid id="myGrid" datapath="myDataset:/mydata/structure" contentdatapath="sample">
<gridtext datapath="@counter" onblur="this.datapath.updateData();">Counter</gridtext>
<gridtext datapath="@description" onblur="this.datapath.updateData();">Description</gridtext>
</grid>
</canvas>
Although that doesn't seem quite right either. I guess I'm after row updates which being low in volume and light in text content could be pushed back to the XML file rather than updating the entire file. Is that possible? Good idea or bad?
Any pointers welcome :)
As always, thanks for your help, it is appreciated.
Kind regards,
Peter
I hate wasting people's time, so I've browsed the vast majority of the 55 odd forum entries on how to update a <grid> trying to figure this out. I also checked the contactlist, xmldata examples and calendar demo looking for something similar with a grid, but couldn't find anything.
There doesn't seem to be any examples that use the updateData() method described in chapter 35 paragraph 3.1 of the reference docs. I've tried it out as best I understand it, but it doesn't seem to work. Consider the following...
<canvas>
<dataset name="myDataset" request="true" src="data.xml"/>
<simplelayout axis="y" spacing="10"/>
<grid id="myGrid" datapath="myDataset:/mydata/structure" contentdatapath="sample"/>
<button onclick="myGrid.datapath.updateData();myGrid.datapath.seria lize();">Update Data</button>
</canvas>
data.xml
_______
<mydata>
<structure>
<sample counter="1" description="update this"/>
<sample counter="2" description="update that"/>
</structure>
</mydata>
You can view the dataset and make changes but they're not updated in the XML file.
Could anyone point me to some more literature on how this works?
Ideally, I'd prefer to send partial updates like...
<canvas>
<dataset name="myDataset" request="true" src="data.xml"/>
<simplelayout axis="y" spacing="10"/>
<grid id="myGrid" datapath="myDataset:/mydata/structure" contentdatapath="sample">
<gridtext datapath="@counter" onblur="this.datapath.updateData();">Counter</gridtext>
<gridtext datapath="@description" onblur="this.datapath.updateData();">Description</gridtext>
</grid>
</canvas>
Although that doesn't seem quite right either. I guess I'm after row updates which being low in volume and light in text content could be pushed back to the XML file rather than updating the entire file. Is that possible? Good idea or bad?
Any pointers welcome :)
As always, thanks for your help, it is appreciated.
Kind regards,
Peter