Hi,
I have a grid based on a DataSource that calls Rest WS. When I add a record in the grid the insert into database is done. The rest WS return this XML
<id>32422</id>
This is the id (oracle sequence) generated by the server.
I override the transformeResponse in DS
protected void transformResponse(DSResponse response, DSRequest request, Object data) {
switch (request.getOperationType()) {
case ADD:
String id = XMLTools.selectString(data, "/id");
response.setAttribute("id", id);
break;
}
super.transformResponse(response, request, data);
}
I add records in the grid with a callback in this way
rec.setAttribute(“name”,“English”);
rolsUsuariGrid.addData(rec, new DSCallback(){
public void execute(DSResponse response, Object rawData, DSRequest
request) {
String id = response.getAttribute(“id”); //id returned by the server
???
}
});
I don’t know how I can assign the id returned by the server to the record just added.
Thanks!