The updateData method always tries to post data to the server. My question is if we can control this so that in cases it changes only the local data (like the clientonly ds does) and does not contacts the server. Or is that a workaround to change the local data only for listgrid. I tried setEditValues, and it seems change the UI only not the resultset behind the scene so if the record in gridlist is selected, the old data shows up in editor. Following is my code:
isc.DataSource.create({
ID:“OTT_findAll”,
title:“OTT_findAll”,
dataFormat:“json”,
dataURL:“/fast_portlets/fastservicejsservlet?Service=OTT_findAll”,
//clientOnly: true,
fields:{
offTerritoryTimeId:{name:“offTerritoryTimeId”, title:“OTT ID”, type:“float”, primaryKey:true, hidden:false, disabled:true},
offTerritoryDate:{name:“offTerritoryDate”, title:“Date”, type:“date”, length:128, required:false},
reason:{name:“reason”, title:“Reason”, length:20, required:false, hidden:false},
duration:{name:“duration”, title:“Duration”, length:50, required:false, hidden:false}
}
});
isc.RPCManager.actionURL = “/fast_portlets/fastserviceservlet”;
isc.VLayout.create({
//top:100,
//left:100,
width:600,
height:400,
minWidth: 300,
minHeight: 200,
position: “relative”,
border:“1px solid blue”,
layoutMargin:5,
canDragResize: true,
members: [
isc.ListGrid.create({
showRollOver:true,
//position:“relative”,
ID:“ottList”,
//autoDraw:true,
dataPageSize: 50,
drawAheadRatio: 4,
alternateRecordStyles:true,
dataSource: OTT_findAll,
height:“*”,
width:“600”,
//edgeSize:5,
canEdit:false,
dataPageSize: 50,
drawAheadRatio: 4,
recordDoubleClick: “recordEdit()”
})
]
});
//dojox.off.files.cache(OTT_findAll.dataURL);
function recordEdit(){
isc.Dialog.create({
title:‘Edit OTT’,
autoSize:true,
isModal:true,
saveData:updateRecord,
toolbarButtons:[
isc.Dialog.OK,
isc.Dialog.CANCEL
],
items:[
isc.DynamicForm.create({
ID:“OTTEditor”,
dataSource: OTT_findAll
//left:30, top:300,
})
]
});
OTTEditor.editSelectedData(ottList);
}
function updateRecord(){
var values = OTTEditor.getValues();
ottList.setEditValues(ottList.getRecordIndex(ottList.getSelectedRecord()), values);
}