Hi,
I’ve put together a test case as requested. It was quite a task to rip out as much of the cruft as possible. The code below works against a February nightly but doesn’t do anything in the latest nightly (tested against 2011-05-17 LGPL).
In writing this test case I figured out that it was the autoCacheAllData: true in WLEService that causes the problem - if I remove that property then it works.
So my question is, is what I’m doing wrong? I have local page variable where I set all my data and I return it on the first fetch() request, or at least that’s the idea.
<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("WLEDataSource", "DataSource").addProperties({
clientOnly: true
,init: function(args) {
this.ID = args.name;
this.Super("init", args);
}
});
isc.defineClass("WLEService", "DataSource").addProperties({
autoCacheAllData: true
,clientOnly: false
,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;
}
}
});
Page.setEvent("load", function() {
ISC_WLE.localData = {"paymentStatuses":{"value":"Paid","name":"Paid"},"invoice":{"currency":"GBP","approved":false,"paymentStatus":"Unpaid","customerName":"SomeCo Intl.","lineItems":[{"dateArrivedAtWarehouse":new Date(1305654896553),"inStock":false,"dateShipped":new Date(1305654896553),"amount":93911.12,"taxRate":"19","quantity":1,"sku":"AKO-191"},{"dateArrivedAtWarehouse":new Date(1305654896553),"inStock":false,"dateShipped":new Date(1305654896553),"amount":1592.91,"taxRate":"19","quantity":5,"sku":"ZJQ-139"}],"date":new Date(1305654896551)}};
WLEDataSource.create({"fields":[{"multiple":false,"type":"text","name":"name"},{"multiple":false,"type":"text","name":"value"}],"name":"NameValuePair"});
WLEDataSource.create({"fields":[{"multiple":false,"type":"text","name":"sku"},{"multiple":false,"type":"integer","name":"quantity"},{"multiple":false,"type":"enum","name":"taxRate"},{"multiple":false,"type":"boolean","name":"inStock"},{"multiple":false,"type":"float","name":"amount"},{"multiple":false,"type":"date","name":"dateArrivedAtWarehouse"},{"multiple":false,"type":"date","name":"dateShipped"}],"name":"LineItem"});
WLEDataSource.create({"fields":[{"multiple":false,"type":"text","name":"customerName"},{"multiple":false,"type":"date","name":"date"},{"multiple":false,"type":"text","name":"paymentStatus"},{"multiple":false,"type":"enum","name":"currency"},{"multiple":false,"type":"boolean","name":"approved"},{"multiple":true,"isComplex":true,"type":"LineItem","name":"lineItems"}],"name":"Invoice"});
WLEService.create({"fields":[{"multiple":false,"isComplex":true,"type":"Invoice","name":"invoice"},{"multiple":false,"isComplex":true,"type":"NameValuePair","name":"paymentStatuses"},{"multiple":false,"type":"text","name":"tmp"},{"type":"text","name":"zTaskId","primaryKey":true}],"name":"Invoice"});
ISC_WLE.localData.zTaskId = "p1";
var serviceDS = DataSource.get("WLEService_Invoice");
serviceDS.fetchData(null, function (dsResponse, data) {alert('callback ok'); isc.logEchoAll(data); } );
});
</script>
</BODY>
</HTML>