PDA

View Full Version : Question about submit data in a grid


enzhu
05-25-2007, 10:06 AM
Hello everyone! I got another question about using grid.
My problem is I have a grid which display multiple rows of data. User should be able to change any value in the grid. There is also a "Submit" button. When user click on "Submit" button, I'll need to send everything in the grid to server. I have my grid here but I have no clue how to pass all the dataset to server. Could you let me know how I can do it? Thank you very much.

Here is my code for the grid:
<canvas width="800" height="600">
<dataset name="records" request="true" type="http" src="http:records.xml"/>
<dataset name="torecords" request="false" type="http" src="http:show.jsp"/>
<window x="20" y="20" width="700" height="500" title="Records">
<view layout="axis:y; spacing:10">
<grid datapath="records:/*">
<gridtext datapath="@name" width="150">Name</gridtext>
<gridtext datapath="@address" width="150">Address</gridtext>
</grid>
<button x="${parent.width/2-width/2}" width="80">Submit
<handler name="onclick">
var d = parent.parent.parent.torecords;
var p = new LzParam();
...
</handler>
</button>
</view>
</window>
</canvas>

enzhu
05-29-2007, 10:09 AM
Could anyone give me some clues on this one? It's really important to me. :(
Thank you very much.

enzhu
05-30-2007, 06:23 AM
Question about grid. When a user edited a field in a grid, is there a way I can know about it? I tried onchange and onclick, it seems none of them work.
<gridtext datapath="${classroot.nametext}" width="150">Name
<handler name="onchange">
Debug.write("Name Changed")
</handler>
<handler name="onchange">
Debug.write("Name Changed")
</handler>
</gridtext>
Thank you very much.

sushil
05-30-2007, 11:48 PM
i will tell u how to get change data
use datapath of this grid

let us suppoese grid has id grid_one

if u write this in debugger you will get change data element of grid

grid_one.datapath.xpathQuery();

enzhu
05-31-2007, 05:21 AM
Hello Sushil, thank you very much!
I tried as you suggested, it returns data for entire grid including changed and unchanged. However We want to send only the rows which were modified. Is there any smart way I can get only the rows of data which were changed? I know I may try to do a comparision between my dataset and result of grid_one.datapath.xpathQuery() in Javascript, but I hope there is better way to do that. Thanks a lot for your kind help!