Hello,
You are correct, I meant to say I use saveLocally set to ‘true’. I’ve corrected my first post.
Below is my testcase, it sets up 2 ListGrids (one with datapath set to ‘/invoice/lineItems’ and the other with it set to ‘/target’). Both ListGrids have saveLocally set to true.
I’ve also set canReorderRecords to true and confirmed that this does not trigger an update operation (correct behavior).
However, if you drag a record from the first to the second then it triggers an update operation (I put an isc.say line in my DataSource to confirm).
Thank you,
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=IE8">
<TITLE>Test Case</TITLE>
<LINK REL="stylesheet" TYPE="text/css" HREF="">
<SCRIPT type="text/javascript">var isomorphicDir="/teamworks/script/custom/isomorphic/";</SCRIPT>
<SCRIPT type="text/javascript" src="script/custom/isomorphic/system/modules/ISC_Core.js"></SCRIPT>
<SCRIPT type="text/javascript" src="script/custom/isomorphic/system/modules/ISC_Foundation.js"></SCRIPT>
<SCRIPT type="text/javascript" src="script/custom/isomorphic/system/modules/ISC_Containers.js"></SCRIPT>
<SCRIPT type="text/javascript" src="script/custom/isomorphic/system/modules/ISC_Grids.js"></SCRIPT>
<SCRIPT type="text/javascript" src="script/custom/isomorphic/system/modules/ISC_Forms.js"></SCRIPT>
<SCRIPT type="text/javascript" src="script/custom/isomorphic/system/modules/ISC_DataBinding.js"></SCRIPT>
<SCRIPT type="text/javascript" src="/teamworks/script/custom/isomorphic/skins/Enterprise/load_skin.js"></SCRIPT>
</HEAD>
<BODY>
<script language="JavaScript">
isc.defineClass("ISC_WLE").addClassProperties({
localData: {}
});
isc.defineClass("WLEVariableType", "DataSource").addProperties({
clientOnly: true
,init: function(args) {
this.ID = args.name;
this.Super("init", args);
}
});
isc.defineClass("WLEService", "DataSource").addProperties({
dataFormat: "custom"
,operationBindings: [
{operationType:"fetch", dataProtocol: 'clientCustom'}
]
,init: function(args) {
this.ID = "WLEService_"+args.name;
this.Super("init", args);
}
,transformRequest: function(dsRequest) {
if (dsRequest.operationType == "fetch") {
var dsResponse = {
clientContext: dsRequest.clientContext
,data: new Array(ISC_WLE.localData)
,totalRows: 1, startRow: 0, endRow: 1 ,status: 0
};
this.processResponse( dsRequest.requestId, dsResponse );
return;
}
else {
isc.say("WLEService called with operation: " + dsRequest.operationType + " - Why?");
}
}
});
function createCanvases() {
isc.VLayout.create({
ID: "rootsection"
,width: 500
,height: 500
,members: [
isc.ListGrid.create({
height: 200
,width: 500
,selectionType: "multiple"
,canSelectRecords: true
,canRemoveRecords: true
,valuesManager: "vmLocal"
,dataPath: "/invoice/lineItems"
,canDragRecordsOut:true
,canAcceptDroppedRecords:true
,dragDataAction:"move" // Works if set to something else
,canReorderRecords:true
,selectionAppearance: "checkbox"
,saveLocally: true // Save locally set to true
,autoSaveEdits: true
,canEdit: true
,dataFetchMode: "local"
,fields: [
{ name: "sku", title: "Sku", canEdit: false, showTitle: true}
,{ canEdit: true, name: "quantity", title: "Quantity", dataPath: "quantity", showTitle: true}
,{ canEdit: true, name: "taxRate", title: "Tax Rate", dataPath: "taxRate", showTitle: true }
,{ type: "boolean", canEdit: true, name: "inStock", title: "In Stock", dataPath: "inStock", showTitle: true}
,{ name: "amount", title: "Amount", canEdit: false,showTitle: true}
,{ type: "date", canEdit: true, name: "dateArrivedAtWarehouse", title: "Date Arrived At Warehouse:", dataPath: "dateArrivedAtWarehouse",showTitle: true}
,{ type: "date", canEdit: true, name: "dateShipped", title: "Date Shipped:", dataPath: "dateShipped", showTitle: true}
]
})
,isc.ListGrid.create({
height: 200
,width: 500
,selectionType: "multiple"
,canSelectRecords: true
,canRemoveRecords: true
,valuesManager: "vmLocal"
,dataPath: "/target"
,canDragRecordsOut:true
,canAcceptDroppedRecords:true
,dragDataAction:"move" // Works if set to something else
,canReorderRecords:true
,selectionAppearance: "checkbox"
,saveLocally: true // Save locally set to true
,autoSaveEdits: true
,canEdit: true
,dataFetchMode: "local"
,fields: [
{ name: "sku", title: "Sku", canEdit: false, showTitle: true}
,{ canEdit: true, name: "quantity", title: "Quantity", dataPath: "quantity", showTitle: true}
,{ canEdit: true, name: "taxRate", title: "Tax Rate", dataPath: "taxRate", showTitle: true }
,{ type: "boolean", canEdit: true, name: "inStock", title: "In Stock", dataPath: "inStock", showTitle: true}
,{ name: "amount", title: "Amount", canEdit: false,showTitle: true}
,{ type: "date", canEdit: true, name: "dateArrivedAtWarehouse", title: "Date Arrived At Warehouse:", dataPath: "dateArrivedAtWarehouse",showTitle: true}
,{ type: "date", canEdit: true, name: "dateShipped", title: "Date Shipped:", dataPath: "dateShipped", showTitle: true}
]
})
]
});
}
Page.setEvent("load", function() {
ISC_WLE.localData = {"invoice":{"currency":"GBP","approved":false,"paymentStatus":"Unpaid","customerName":"SomeCo Intl.","lineItems":[{"dateArrivedAtWarehouse":new Date(1307847949922),"inStock":false,"dateShipped":new Date(1307847949922),"amount":93911.12,"taxRate":"19","quantity":1,"sku":"AKO-191"},{"dateArrivedAtWarehouse":new Date(1307847949922),"inStock":false,"dateShipped":new Date(1307847949922),"amount":1592.91,"taxRate":"19","quantity":5,"sku":"ZJQ-139"},{"dateArrivedAtWarehouse":new Date(1307847949922),"inStock":false,"dateShipped":new Date(1307847949922),"amount":232.91,"taxRate":"0","quantity":4,"sku":"ZJQ-277"}],"date":new Date(1307847949922)}};
ISC_WLE.localData.zTaskId = "p1";
WLEVariableType.create({"fields":[{"type":"text","WLEType":"String","name":"customerName"},{"type":"datetime","WLEType":"Date","name":"date"},{"type":"text","WLEType":"String","name":"paymentStatus"},{"type":"enum","WLEType":"Currency","name":"currency","valueMap":{"EUR":"EUR","NA":"N/A","GBP":"GBP","USD":"USD"}},{"type":"boolean","WLEType":"Boolean","name":"approved"},{"multiple":true,"isComplex":true,"type":"LineItem","name":"lineItems","valueXPath":"lineItems/item"}],"name":"Invoice"});
WLEVariableType.create({"fields":[{"type":"text","WLEType":"String","name":"sku"},{"type":"integer","WLEType":"Integer","name":"quantity"},{"type":"enum","WLEType":"TaxRate","name":"taxRate","valueMap":{"0":"Zero Rated","5":"Discounted (5%)","19":"Standard (19%)"}},{"type":"boolean","WLEType":"Boolean","name":"inStock"},{"type":"float","WLEType":"MonetaryAmount","name":"amount"},{"type":"datetime","WLEType":"Date","name":"dateArrivedAtWarehouse"},{"type":"datetime","WLEType":"Date","name":"dateShipped"}],"name":"LineItem"});
WLEService.create({"fields":[{"isComplex":true,"type":"Invoice","name":"invoice"},{"multiple":true,"isComplex":true,"type":"LineItem","name":"target","valueXPath":"item"},{"type":"text","name":"zTaskId","primaryKey":true}],"name":"Invoice"});
var serviceDS = DataSource.get("WLEService_Invoice");
isc.ValuesManager.create({
ID: "vmLocal"
,dataSource: serviceDS
});
vmLocal.fetchData();
createCanvases();
});
</script>
</BODY>
</HTML>