Hi Isomorphic,
We are using the SmartClient Version: v9.1p_2015-03-18/Pro Deployment (built 2015-03-18).
In my code, I have 2 local DataSources, 1 TreeGrid and 1 ListGrid.
To simplify the issue, I’ve removed all my code and added 3 action buttons to change DataSource in the TreeGrid and ListGrid.
After clicking on those buttons randomly, I always receive the following error when I’m using the ‘isomorphic/system/modules-debug’ version:
(I receive the same error when using the ‘isomorphic/system/modules’ version and when using the SmartClient_v91p_2015-01-13_Pro build)
(It is always in the ISC_DataBinding.js: getRange : function)
14:19:40.158:MUP0:WARN:Log:TypeError: Cannot read property 'length' of undefined
Stack from error.stack:
ResultSet.getRange(<no args: exited>) on [ResultSet ID:isc_ResultSet_5 (dataSource: data1TreeDS, created by: (cacheAllData fetch))] @ ISC_DataBinding.js:42445:41
ResultSet.getAllRows(<no args: exited>) on [ResultSet ID:isc_ResultSet_5 (dataSource: data1TreeDS, created by: (cacheAllData fetch))] @ ISC_DataBinding.js:42465:17
[o]ResultSet.dataArrived(<no args: exited>) on [ResultSet ID:isc_ResultSet_5 (dataSource: data1TreeDS, created by: (cacheAllData fetch))] @ ISC_DataBinding.js:24876:74
ResultSet.filterLocalData(<no args: exited>) on [ResultSet ID:isc_ResultSet_5 (dataSource: data1TreeDS, created by: (cacheAllData fetch))] @ ISC_DataBinding.js:45263:14
ResultSet.setCriteria(<no args: exited>) on [ResultSet ID:isc_ResultSet_5 (dataSource: data1TreeDS, created by: (cacheAllData fetch))] @ ISC_DataBinding.js:43359:66
ResultSet.init(<no args: exited>) on [ResultSet ID:isc_ResultSet_5 (dataSource: data1TreeDS, created by: (cacheAllData fetch))] @ ISC_DataBinding.js:42018:14
[a]ResultSet.completeCreation(<no args: exited>) on [ResultSet ID:isc_ResultSet_5 (dataSource: data1TreeDS, created by: (cacheAllData fetch))] @ ISC_Core.js:7028:14
[c]ResultSet.create(<no args: exited>) @ ISC_Core.js:4546:39
DataSource.firstCacheAllDataRequest(<no args: exited>) on [DataSource ID:data1TreeDS] @ ISC_DataBinding.js:24855:45
DataSource.fetchingClientOnlyData(<no args: exited>) on [DataSource ID:data1TreeDS] @ ISC_DataBinding.js:24978:25
Can you please tell me how I can fix it?
Thank you.
Please see the code:
<HTML>
<HEAD>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Tree</title>
<script>var isomorphicDir = "isomorphic/";</script>
<SCRIPT SRC=isomorphic/system/modules-debug/ISC_Core.js></SCRIPT><SCRIPT>isc._lastModule='Core';</SCRIPT>
<SCRIPT SRC=isomorphic/system/modules-debug/ISC_Foundation.js></SCRIPT><SCRIPT>isc._lastModule='Foundation';</SCRIPT>
<SCRIPT SRC=isomorphic/system/modules-debug/ISC_Containers.js></SCRIPT><SCRIPT>isc._lastModule='Containers';</SCRIPT>
<SCRIPT SRC=isomorphic/system/modules-debug/ISC_Grids.js></SCRIPT><SCRIPT>isc._lastModule='Grids';</SCRIPT>
<SCRIPT SRC=isomorphic/system/modules-debug/ISC_Forms.js></SCRIPT><SCRIPT>isc._lastModule='Forms';</SCRIPT>
<SCRIPT SRC=isomorphic/system/modules-debug/ISC_DataBinding.js></SCRIPT><SCRIPT>isc._lastModule='DataBinding';</SCRIPT>
<SCRIPT SRC=isomorphic/system/modules-debug/ISC_Drawing.js></SCRIPT><SCRIPT>isc._lastModule='Drawing';</SCRIPT>
<SCRIPT SRC=isomorphic/skins/Enterprise/load_skin.js></SCRIPT>
</HEAD>
<BODY BGCOLOR=#D3D3D3>
<SCRIPT>
var setPageTimer = null;
var initView = false;
var data2View = false;
var data1 = [
{"id":1,"capId":1,"parentId":0,"Name":"data1Group1","Url":"","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":2,"capId":"1.1","parentId":1,"Name":"App1","Url":"http://www.smartclient.com","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":true,"isOK":true},
{"id":3,"capId":"1.2","parentId":1,"Name":"App2","Url":"http://www.smartclient.com","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":true,"isOK":true},
{"id":4,"capId":"1.3","parentId":1,"Name":"App3","Url":"http://www.smartclient.com","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":true,"isOK":true},
{"id":5,"capId":"1.4","parentId":1,"Name":"App4","Url":"http://www.smartclient.com","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":true,"isOK":true},
{"id":6,"capId":"1.7","parentId":1,"Name":"invalidUrl","Url":"/url2","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":true,"isOK":false},
{"id":7,"capId":"2","parentId":0,"Name":"data1Group2","Url":"","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":8,"capId":"2.10","parentId":"2","Name":"wikipedia","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":true,"isMenu":true,"isOK":true},
{"id":9,"capId":"3","parentId":0,"Name":"data1EmptyGroup3","Url":"","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":10,"capId":"5","parentId":0,"Name":"data1Group4","Url":"","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":11,"capId":"5.5","parentId":"5","Name":"invalidApp","Url":"http://invalidUrl","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":true,"isOK":false},
{"id":12,"capId":"5.6","parentId":"5","Name":"invalidUrl","Url":"http://www.invalidUrl","isFolder":false,"isOpen":false,"isExternal":true,"isMenu":true,"isOK":true},
{"id":14,"capId":"5.9","parentId":"5","Name":"foxnews","Url":"http://www.foxnews.com","isFolder":false,"isOpen":false,"isExternal":true,"isMenu":true,"isOK":true,},
{"id":15,"capId":"5.11","parentId":"5","Name":"wikipedia","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":true,"isMenu":true,"isOK":true},
{"id":1001,"capId":1001,"parentId":"1.1","Name":"app1Link1","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":1002,"capId":1002,"parentId":"1.1","Name":"app1Link2","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":1003,"capId":1003,"parentId":"1.2","Name":"app2Link3","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":1004,"capId":1004,"parentId":"1.2","Name":"app2Link4","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":1005,"capId":1005,"parentId":"1.3","Name":"app3Link5","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":1006,"capId":1006,"parentId":"1.4","Name":"app4Link6","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":1007,"capId":1007,"parentId":"1.4","Name":"app4Link7","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true}
];
var data2 = [
{"id":1,"capId":1,"parentId":0,"Name":"data2Group1","Url":"","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":2,"capId":2,"parentId":0,"Name":"data2Group2","Url":"","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":3,"capId":"2.10","parentId":2,"Name":"wikipedia","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":true,"isMenu":true,"isOK":true},
{"id":4,"capId":3,"parentId":0,"Name":"data2EmptyGroup3","Url":"","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":5,"capId":5,"parentId":0,"Name":"data2Group4","Url":"","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":6,"capId":"5.6","parentId":5,"Name":"invalidUrl","Url":"http://www.invalidUrl","isFolder":false,"isOpen":false,"isExternal":true,"isMenu":true,"isOK":true},
{"id":7,"capId":"5.9","parentId":5,"Name":"foxnews","Url":"http://www.foxnews.com","isFolder":false,"isOpen":false,"isExternal":true,"isMenu":true,"isOK":true},
{"id":8,"capId":"5.11","parentId":5,"Name":"wikipedia","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":true,"isMenu":true,"isOK":true},
{"id":2001,"capId":"1-A","parentId":1,"Name":"data2App-A","Url":"http://www.smartclient.com","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":true,"isOK":true},
{"id":2002,"capId":"1-B","parentId":1,"Name":"data2App-B","Url":"http://www.smartclient.com","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":true,"isOK":true},
{"id":1001,"capId":1001,"parentId":"1-A","Name":"data2Link1-A","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":1002,"capId":1002,"parentId":"1-A","Name":"data2Link2-A","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":1003,"capId":1003,"parentId":"1-A","Name":"data2Link3-A","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":1004,"capId":1004,"parentId":"1-B","Name":"data2Link4-B","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":1005,"capId":1005,"parentId":"1-B","Name":"data2Link5-B","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":1006,"capId":1006,"parentId":"1-B","Name":"data2Link6-B","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":2003,"capId":"1-C","parentId":1,"Name":"data2App-C","Url":"http://www.smartclient.com","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":true,"isOK":true},
{"id":1007,"capId":1007,"parentId":"1-C","Name":"data2Link12-C","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true}
];
isc.DataSource.create({
ID:"data1TreeDS",
allowAdvancedCriteria:true,
cacheAllData:true,
dataFormat:"json",
clientOnly:true,
fields:[
{name:"id", title:"id", type:"integer", required:true},
{name:"capId", title:"capId", type:"text", length:"64", primaryKey:true, required:true},
{name:"parentId", title:"parentId", type:"text", length:"64", foreignKey:"data1TreeDS.capId", rootValue:"0", required:true},
{name:"Name", title:"Name", type:"text", length:"64", required:true},
{name:"Url", title:"Url", type:"text", length:"128"},
{name:"isOpen", title:"isOpen", type:"boolean"},
{name:"isFolder", title:"isFolder", type:"boolean"},
{name:"isExternal", title:"isExternal", type:"boolean"},
{name:"isMenu", title:"isMenu", type:"boolean"},
{name:"isOK", title:"isOK", type:"boolean"}
]
});
isc.DataSource.create({
ID:"data2TreeDS",
allowAdvancedCriteria:true,
cacheAllData:true,
dataFormat:"json",
clientOnly:true,
fields:[
{name:"id", title:"id", type:"integer", required:true},
{name:"capId", title:"capId", type:"text", length:"64", primaryKey:true, required:true},
{name:"parentId", title:"parentId", type:"text", length:"64", foreignKey:"data2TreeDS.capId", rootValue:"0", required:true},
{name:"Name", title:"Name", type:"text", length:"64", required:true},
{name:"Url", title:"Url", type:"text", length:"128"},
{name:"isOpen", title:"isOpen", type:"boolean"},
{name:"isFolder", title:"isFolder", type:"boolean"},
{name:"isExternal", title:"isExternal", type:"boolean"},
{name:"isMenu", title:"isMenu", type:"boolean"},
{name:"isOK", title:"isOK", type:"boolean"}
]
});
data1TreeDS.addProperties({
transformResponse: function (dsResponse, dsRequest, data) {
//if (dsResponse != null && dsResponse.data) Log.logInfo("data1TreeDS.transformResponse.OperationType = " + dsRequest.operationType + " | JSON.stringify(dsResponse.data) = " + JSON.stringify(dsResponse.data));
},
print : function () {
var cache = this.getCacheData()
if (cache != null && cache !== undefined) {
Log.logInfo("data1TreeDS.print.cacheLength = " + cache.length);
for (i = 0; i < cache.length; i++) {
var rec = cache[i];
if (rec != null) Log.logInfo("data1TreeDS.print.i = " + i + " | id = " + rec.id + " | capId = " + rec.capId + " | parentId = " + rec.parentId + " | recName = " + rec.Name + " | Url = " + rec.Url + " | isFolder = " + rec.isFolder + " | isMenu = " + rec.isMenu + " | isExternal = " + rec.isExternal);
}
}
}
});
data2TreeDS.addProperties({
print : function () {
var cache = this.getCacheData()
if (cache != null && cache !== undefined) {
Log.logInfo("data2TreeDS.print.cacheLength = " + cache.length);
for (i = 0; i < cache.length; i++) {
var rec = cache[i];
if (rec != null) Log.logInfo("data2TreeDS.print.i = " + i + " | id = " + rec.id + " | capId = " + rec.capId + " | parentId = " + rec.parentId + " | recName = " + rec.Name + " | Url = " + rec.Url + " | isFolder = " + rec.isFolder + " | isMenu = " + rec.isMenu + " | isExternal = " + rec.isExternal);
}
}
}
});
isc.TreeGrid.create({
ID:"treeGrid",
dismissable: false,
modalMaskOpacity: 25,
autoDraw:false,
width:"100%", height:"100%",
nodeIcon:"[SKIN]/connector.png",
folderIcon:"[SKIN]/folder.png",
closedIconSuffix:"close",
showConnectors:true,
showOpenIcons:true,
showDropIcons:false,
selectionType:"single",
dataSource:"data1TreeDS",
dataFetchMode: "local",
autoFetchData:false,
loadDataOnDemand:true,
canEdit: false,
canRemoveRecords: false,
showHeader: false,
border: "none",
backgroundColor: "white",
showSortArrow: "none",
dataProperties: {
modelType:"parent",
rootValue:"0",
idField:"capId",
parentIdField:"parentId",
openProperty:"isOpen",
folderProperty:"isFolder",
selectionProperty:"isSelected"
},
fields:[
{name:"Name"}
],
getIcon: function(node){
if (node.isExternal)
return "[SKIN]/file.png";
if (node.isMenu && node.isOK)
return "[SKIN]/folder_file.png";
if (node.isMenu && !node.isOK)
return "[SKIN]/folder_file.png";
if (node.isFolder)
return "[SKIN]/folder_file.png";
return "[SKIN]/file.png";
},
dataArrived : function (node) {
//if (node != null) Log.logInfo("treeGrid.dataArrived.node.id = " + node.id + " | capId = " + node.capId + " | parentId = " + node.parentId + " | recName = " + node.Name + " | Url = " + node.Url + " | isFolder = " + node.isFolder + " | isMenu = " + node.isMenu + " | isExternal = " + node.isExternal);
if (node != null && node.isFolder) {
var ch = node.children;
if (ch != null && ch !== undefined) {
//Log.logInfo("treeGrid.dataArrived.children.length = " + ch.length);
for (var c = 0; c < ch.length; c++) {
if (ch[c].isFolder)
this.openFolder(ch[c]);
}
}
}
},
nodeClick : function (treeGrid, node, recordNum) {
if (node.Url != null && node.Url.length > 0) {
htmlPane.contentsURL = node.Url;
appArea.showMember(htmlPane);
htmlPane.markForRedraw();
}
}
});
isc.ListGrid.create({
ID: "groupList",
width:"50%", height:"100%",
autoDraw:false,
selectionType:"single",
dataSource:"data1TreeDS",
dataFetchMode: "local",
autoFetchData:false,
overflow:"auto",
canEdit: false,
showHeader: true,
headerHeight: 20,
//headerSpanHeight: 20,
showHeaderMenuButton: false,
border: "1px solid darkgray",
backgroundColor: "white",
layoutAlign: "center",
fields:[
{name:"Name", title: "Name"}
],
gridComponents:["header", "body"],
hideFields: function() {
this.hideField("id");
this.hideField("capId");
this.hideField("parentId");
this.hideField("Url");
this.hideField("isOpen");
this.hideField("isFolder");
this.hideField("isExternal");
this.hideField("isMenu");
this.hideField("isOK");
}
});
isc.Window.create({
ID: "viewWindow",
title: "View",
showTitle: true,
autoDraw: false,
width:"70%", height:"70%",
overflow:"auto",
autoCenter: true,
isModal: true,
showModalMask: true,
modalMaskOpacity: 20,
showCloseButton: true,
showMinimizeButton: false,
showHeaderIcon: false,
vertical: true,
layoutMargin: 10,
membersMargin: 10,
paddingAsLayoutMargin: true,
items: [
isc.HLayout.create({
width:"100%", height:"90%",
autoDraw:false,
overflow:"auto",
layoutMargin: 10,
membersMargin: 10,
members:["groupList"]
}),
isc.LayoutSpacer.create(),
isc.HLayout.create({
width:"100%", height:"10%",
autoDraw:false,
overflow:"hidden",
layoutMargin: 10,
membersMargin: 10,
members:[
isc.LayoutSpacer.create(),
isc.IButton.create({
title:"Close",
autoDraw:false,
icon: "[SKIN]/actions/close.png",
click: function () {
viewWindow.hide();
treeGrid.filterData(
{isOK:true},
function (dsResponse, data, dsRequest) {
},
{willHandleError: true}
);
treeGrid.getData().openAll();
treeGrid.loadDataOnDemand = true;
isc.RPCManager.setPage();
}
})
]
}),
isc.LayoutSpacer.create()
]
});
isc.HTMLPane.create({
ID:"htmlPane",
width:"100%", height:"100%",
autoDraw:false,
contentsType: "page",
overflow:"auto",
showEdges: false
});
isc.IButton.create({
ID:"data1Button",
title:"Set Data1 View",
autoDraw:false,
click: function () {
data2View = false;
var flag = isc.RPCManager.setView(data2View);
if (flag)
treeGrid.getData().openAll();
}
});
isc.IButton.create({
ID:"data2Button",
title:"Set Data2 View",
autoDraw:false,
click: function () {
data2View = true;
var flag = isc.RPCManager.setView(data2View);
if (flag)
treeGrid.getData().openAll();
}
});
isc.IButton.create({
ID:"groupButton",
title:"View Groups",
autoDraw:false,
click: function () {
//data1TreeDS.print(); // >>> TEST ONLY
groupList.filterData(
{isFolder:true, isMenu:false},
function (dsResponse, data, dsRequest) {},
{willHandleError: true}
);
viewWindow.show();
}
});
isc.VLayout.create({
ID:"left",
top: 50,
width:300, height:"100%",
minWidth:200,
autoDraw:false,
overflow:"hidden",
showResizeBar: true,
border: "1px solid darkgray",
members:["treeGrid", "data1Button", "data2Button", "groupButton"]
});
isc.VLayout.create({
ID:"appArea",
width:"100%", height:"100%",
autoDraw:false,
overflow:"hidden",
border:"1px solid darkgray",
members:["htmlPane"]
});
isc.HLayout.create({
ID:"body",
width:"100%", height:"100%",
autoDraw:false,
overflow:"hidden",
border: "1px solid darkgray",
members:["left", "appArea"]
});
isc.VLayout.create({
ID:"mainlayout",
width:"100%", height:"100%",
autoDraw:false,
overflow:"hidden",
members:["body"]
});
isc.RPCManager.addClassProperties({
handleTransportError : function (transactionNum, status, httpResponseCode, httpResponseText) {
//Log.logInfo("RPCManager.handleTransportError.transactionNum = " + transactionNum + ", status = " + status + ", httpResponseCode = " + httpResponseCode + ", httpResponseText = " + httpResponseText);
},
handleError : function (response, request) {
//Log.logInfo("RPCManager.handleError.response = " + response + ", response.status = " + response.status + ", request = " + request + ", request.data = " + request.data);
},
setView : function(data2) {
var dsId = null;
var ds = treeGrid.getDataSource();
if (ds != null && ds !== undefined && ds.ID != null && ds.ID !== undefined)
dsId = ds.ID;
var set = false;
if (data2) {
if (dsId != 'data2TreeDS') {
treeGrid.setDataSource(data2TreeDS);
treeGrid.filterData(
null,
function (dsResponse, data, dsRequest) {},
{willHandleError: true}
);
groupList.setDataSource(data2TreeDS);
groupList.hideFields();
return true;
}
}
else {
if (dsId != 'data1TreeDS') {
treeGrid.setDataSource(data1TreeDS);
treeGrid.filterData(
{isOK:true},
function (dsResponse, data, dsRequest) {},
{willHandleError: true}
);
groupList.setDataSource(data1TreeDS);
groupList.hideFields();
return true;
}
}
return false;
},
setPage : function() {
if (setPageTimer == null) {
setPageTimer = isc.Timer.setTimeout(function() {
if (!initView) {
initView = true;
data2View = false;
isc.RPCManager.setView(data2View);
treeGrid.getData().openAll();
treeGrid.loadDataOnDemand = true;
isc.RPCManager.filterOK();
}
},1000);
}
},
filterOK : function () {
treeGrid.filterData(
{isOK:true},
function (dsResponse, data, dsRequest) {
},
{willHandleError: true}
);
},
refresh : function () {
mainlayout.draw();
for (var data1Index = 0; data1Index < data1.length; data1Index++) {
data1TreeDS.addData(data1[data1Index]);
}
for (var data2Index = 0; data2Index < data2.length; data2Index++) {
data2TreeDS.addData(data2[data2Index]);
}
treeGrid.fetchData(
null,
function (dsResponse, data, dsRequest) {
treeGrid.getData().openAll();
treeGrid.loadDataOnDemand = true;
isc.RPCManager.setPage();
},
{willHandleError: true}
);
}
});
isc.showConsole();
isc.RPCManager.refresh();
</SCRIPT>
</BODY></HTML>
We are using the SmartClient Version: v9.1p_2015-03-18/Pro Deployment (built 2015-03-18).
In my code, I have 2 local DataSources, 1 TreeGrid and 1 ListGrid.
To simplify the issue, I’ve removed all my code and added 3 action buttons to change DataSource in the TreeGrid and ListGrid.
After clicking on those buttons randomly, I always receive the following error when I’m using the ‘isomorphic/system/modules-debug’ version:
(I receive the same error when using the ‘isomorphic/system/modules’ version and when using the SmartClient_v91p_2015-01-13_Pro build)
(It is always in the ISC_DataBinding.js: getRange : function)
14:19:40.158:MUP0:WARN:Log:TypeError: Cannot read property 'length' of undefined
Stack from error.stack:
ResultSet.getRange(<no args: exited>) on [ResultSet ID:isc_ResultSet_5 (dataSource: data1TreeDS, created by: (cacheAllData fetch))] @ ISC_DataBinding.js:42445:41
ResultSet.getAllRows(<no args: exited>) on [ResultSet ID:isc_ResultSet_5 (dataSource: data1TreeDS, created by: (cacheAllData fetch))] @ ISC_DataBinding.js:42465:17
[o]ResultSet.dataArrived(<no args: exited>) on [ResultSet ID:isc_ResultSet_5 (dataSource: data1TreeDS, created by: (cacheAllData fetch))] @ ISC_DataBinding.js:24876:74
ResultSet.filterLocalData(<no args: exited>) on [ResultSet ID:isc_ResultSet_5 (dataSource: data1TreeDS, created by: (cacheAllData fetch))] @ ISC_DataBinding.js:45263:14
ResultSet.setCriteria(<no args: exited>) on [ResultSet ID:isc_ResultSet_5 (dataSource: data1TreeDS, created by: (cacheAllData fetch))] @ ISC_DataBinding.js:43359:66
ResultSet.init(<no args: exited>) on [ResultSet ID:isc_ResultSet_5 (dataSource: data1TreeDS, created by: (cacheAllData fetch))] @ ISC_DataBinding.js:42018:14
[a]ResultSet.completeCreation(<no args: exited>) on [ResultSet ID:isc_ResultSet_5 (dataSource: data1TreeDS, created by: (cacheAllData fetch))] @ ISC_Core.js:7028:14
[c]ResultSet.create(<no args: exited>) @ ISC_Core.js:4546:39
DataSource.firstCacheAllDataRequest(<no args: exited>) on [DataSource ID:data1TreeDS] @ ISC_DataBinding.js:24855:45
DataSource.fetchingClientOnlyData(<no args: exited>) on [DataSource ID:data1TreeDS] @ ISC_DataBinding.js:24978:25
Can you please tell me how I can fix it?
Thank you.
Please see the code:
<HTML>
<HEAD>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Tree</title>
<script>var isomorphicDir = "isomorphic/";</script>
<SCRIPT SRC=isomorphic/system/modules-debug/ISC_Core.js></SCRIPT><SCRIPT>isc._lastModule='Core';</SCRIPT>
<SCRIPT SRC=isomorphic/system/modules-debug/ISC_Foundation.js></SCRIPT><SCRIPT>isc._lastModule='Foundation';</SCRIPT>
<SCRIPT SRC=isomorphic/system/modules-debug/ISC_Containers.js></SCRIPT><SCRIPT>isc._lastModule='Containers';</SCRIPT>
<SCRIPT SRC=isomorphic/system/modules-debug/ISC_Grids.js></SCRIPT><SCRIPT>isc._lastModule='Grids';</SCRIPT>
<SCRIPT SRC=isomorphic/system/modules-debug/ISC_Forms.js></SCRIPT><SCRIPT>isc._lastModule='Forms';</SCRIPT>
<SCRIPT SRC=isomorphic/system/modules-debug/ISC_DataBinding.js></SCRIPT><SCRIPT>isc._lastModule='DataBinding';</SCRIPT>
<SCRIPT SRC=isomorphic/system/modules-debug/ISC_Drawing.js></SCRIPT><SCRIPT>isc._lastModule='Drawing';</SCRIPT>
<SCRIPT SRC=isomorphic/skins/Enterprise/load_skin.js></SCRIPT>
</HEAD>
<BODY BGCOLOR=#D3D3D3>
<SCRIPT>
var setPageTimer = null;
var initView = false;
var data2View = false;
var data1 = [
{"id":1,"capId":1,"parentId":0,"Name":"data1Group1","Url":"","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":2,"capId":"1.1","parentId":1,"Name":"App1","Url":"http://www.smartclient.com","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":true,"isOK":true},
{"id":3,"capId":"1.2","parentId":1,"Name":"App2","Url":"http://www.smartclient.com","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":true,"isOK":true},
{"id":4,"capId":"1.3","parentId":1,"Name":"App3","Url":"http://www.smartclient.com","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":true,"isOK":true},
{"id":5,"capId":"1.4","parentId":1,"Name":"App4","Url":"http://www.smartclient.com","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":true,"isOK":true},
{"id":6,"capId":"1.7","parentId":1,"Name":"invalidUrl","Url":"/url2","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":true,"isOK":false},
{"id":7,"capId":"2","parentId":0,"Name":"data1Group2","Url":"","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":8,"capId":"2.10","parentId":"2","Name":"wikipedia","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":true,"isMenu":true,"isOK":true},
{"id":9,"capId":"3","parentId":0,"Name":"data1EmptyGroup3","Url":"","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":10,"capId":"5","parentId":0,"Name":"data1Group4","Url":"","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":11,"capId":"5.5","parentId":"5","Name":"invalidApp","Url":"http://invalidUrl","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":true,"isOK":false},
{"id":12,"capId":"5.6","parentId":"5","Name":"invalidUrl","Url":"http://www.invalidUrl","isFolder":false,"isOpen":false,"isExternal":true,"isMenu":true,"isOK":true},
{"id":14,"capId":"5.9","parentId":"5","Name":"foxnews","Url":"http://www.foxnews.com","isFolder":false,"isOpen":false,"isExternal":true,"isMenu":true,"isOK":true,},
{"id":15,"capId":"5.11","parentId":"5","Name":"wikipedia","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":true,"isMenu":true,"isOK":true},
{"id":1001,"capId":1001,"parentId":"1.1","Name":"app1Link1","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":1002,"capId":1002,"parentId":"1.1","Name":"app1Link2","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":1003,"capId":1003,"parentId":"1.2","Name":"app2Link3","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":1004,"capId":1004,"parentId":"1.2","Name":"app2Link4","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":1005,"capId":1005,"parentId":"1.3","Name":"app3Link5","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":1006,"capId":1006,"parentId":"1.4","Name":"app4Link6","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":1007,"capId":1007,"parentId":"1.4","Name":"app4Link7","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true}
];
var data2 = [
{"id":1,"capId":1,"parentId":0,"Name":"data2Group1","Url":"","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":2,"capId":2,"parentId":0,"Name":"data2Group2","Url":"","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":3,"capId":"2.10","parentId":2,"Name":"wikipedia","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":true,"isMenu":true,"isOK":true},
{"id":4,"capId":3,"parentId":0,"Name":"data2EmptyGroup3","Url":"","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":5,"capId":5,"parentId":0,"Name":"data2Group4","Url":"","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":6,"capId":"5.6","parentId":5,"Name":"invalidUrl","Url":"http://www.invalidUrl","isFolder":false,"isOpen":false,"isExternal":true,"isMenu":true,"isOK":true},
{"id":7,"capId":"5.9","parentId":5,"Name":"foxnews","Url":"http://www.foxnews.com","isFolder":false,"isOpen":false,"isExternal":true,"isMenu":true,"isOK":true},
{"id":8,"capId":"5.11","parentId":5,"Name":"wikipedia","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":true,"isMenu":true,"isOK":true},
{"id":2001,"capId":"1-A","parentId":1,"Name":"data2App-A","Url":"http://www.smartclient.com","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":true,"isOK":true},
{"id":2002,"capId":"1-B","parentId":1,"Name":"data2App-B","Url":"http://www.smartclient.com","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":true,"isOK":true},
{"id":1001,"capId":1001,"parentId":"1-A","Name":"data2Link1-A","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":1002,"capId":1002,"parentId":"1-A","Name":"data2Link2-A","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":1003,"capId":1003,"parentId":"1-A","Name":"data2Link3-A","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":1004,"capId":1004,"parentId":"1-B","Name":"data2Link4-B","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":1005,"capId":1005,"parentId":"1-B","Name":"data2Link5-B","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":1006,"capId":1006,"parentId":"1-B","Name":"data2Link6-B","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true},
{"id":2003,"capId":"1-C","parentId":1,"Name":"data2App-C","Url":"http://www.smartclient.com","isFolder":true,"isOpen":false,"isExternal":false,"isMenu":true,"isOK":true},
{"id":1007,"capId":1007,"parentId":"1-C","Name":"data2Link12-C","Url":"http://www.wikipedia.com","isFolder":false,"isOpen":false,"isExternal":false,"isMenu":false,"isOK":true}
];
isc.DataSource.create({
ID:"data1TreeDS",
allowAdvancedCriteria:true,
cacheAllData:true,
dataFormat:"json",
clientOnly:true,
fields:[
{name:"id", title:"id", type:"integer", required:true},
{name:"capId", title:"capId", type:"text", length:"64", primaryKey:true, required:true},
{name:"parentId", title:"parentId", type:"text", length:"64", foreignKey:"data1TreeDS.capId", rootValue:"0", required:true},
{name:"Name", title:"Name", type:"text", length:"64", required:true},
{name:"Url", title:"Url", type:"text", length:"128"},
{name:"isOpen", title:"isOpen", type:"boolean"},
{name:"isFolder", title:"isFolder", type:"boolean"},
{name:"isExternal", title:"isExternal", type:"boolean"},
{name:"isMenu", title:"isMenu", type:"boolean"},
{name:"isOK", title:"isOK", type:"boolean"}
]
});
isc.DataSource.create({
ID:"data2TreeDS",
allowAdvancedCriteria:true,
cacheAllData:true,
dataFormat:"json",
clientOnly:true,
fields:[
{name:"id", title:"id", type:"integer", required:true},
{name:"capId", title:"capId", type:"text", length:"64", primaryKey:true, required:true},
{name:"parentId", title:"parentId", type:"text", length:"64", foreignKey:"data2TreeDS.capId", rootValue:"0", required:true},
{name:"Name", title:"Name", type:"text", length:"64", required:true},
{name:"Url", title:"Url", type:"text", length:"128"},
{name:"isOpen", title:"isOpen", type:"boolean"},
{name:"isFolder", title:"isFolder", type:"boolean"},
{name:"isExternal", title:"isExternal", type:"boolean"},
{name:"isMenu", title:"isMenu", type:"boolean"},
{name:"isOK", title:"isOK", type:"boolean"}
]
});
data1TreeDS.addProperties({
transformResponse: function (dsResponse, dsRequest, data) {
//if (dsResponse != null && dsResponse.data) Log.logInfo("data1TreeDS.transformResponse.OperationType = " + dsRequest.operationType + " | JSON.stringify(dsResponse.data) = " + JSON.stringify(dsResponse.data));
},
print : function () {
var cache = this.getCacheData()
if (cache != null && cache !== undefined) {
Log.logInfo("data1TreeDS.print.cacheLength = " + cache.length);
for (i = 0; i < cache.length; i++) {
var rec = cache[i];
if (rec != null) Log.logInfo("data1TreeDS.print.i = " + i + " | id = " + rec.id + " | capId = " + rec.capId + " | parentId = " + rec.parentId + " | recName = " + rec.Name + " | Url = " + rec.Url + " | isFolder = " + rec.isFolder + " | isMenu = " + rec.isMenu + " | isExternal = " + rec.isExternal);
}
}
}
});
data2TreeDS.addProperties({
print : function () {
var cache = this.getCacheData()
if (cache != null && cache !== undefined) {
Log.logInfo("data2TreeDS.print.cacheLength = " + cache.length);
for (i = 0; i < cache.length; i++) {
var rec = cache[i];
if (rec != null) Log.logInfo("data2TreeDS.print.i = " + i + " | id = " + rec.id + " | capId = " + rec.capId + " | parentId = " + rec.parentId + " | recName = " + rec.Name + " | Url = " + rec.Url + " | isFolder = " + rec.isFolder + " | isMenu = " + rec.isMenu + " | isExternal = " + rec.isExternal);
}
}
}
});
isc.TreeGrid.create({
ID:"treeGrid",
dismissable: false,
modalMaskOpacity: 25,
autoDraw:false,
width:"100%", height:"100%",
nodeIcon:"[SKIN]/connector.png",
folderIcon:"[SKIN]/folder.png",
closedIconSuffix:"close",
showConnectors:true,
showOpenIcons:true,
showDropIcons:false,
selectionType:"single",
dataSource:"data1TreeDS",
dataFetchMode: "local",
autoFetchData:false,
loadDataOnDemand:true,
canEdit: false,
canRemoveRecords: false,
showHeader: false,
border: "none",
backgroundColor: "white",
showSortArrow: "none",
dataProperties: {
modelType:"parent",
rootValue:"0",
idField:"capId",
parentIdField:"parentId",
openProperty:"isOpen",
folderProperty:"isFolder",
selectionProperty:"isSelected"
},
fields:[
{name:"Name"}
],
getIcon: function(node){
if (node.isExternal)
return "[SKIN]/file.png";
if (node.isMenu && node.isOK)
return "[SKIN]/folder_file.png";
if (node.isMenu && !node.isOK)
return "[SKIN]/folder_file.png";
if (node.isFolder)
return "[SKIN]/folder_file.png";
return "[SKIN]/file.png";
},
dataArrived : function (node) {
//if (node != null) Log.logInfo("treeGrid.dataArrived.node.id = " + node.id + " | capId = " + node.capId + " | parentId = " + node.parentId + " | recName = " + node.Name + " | Url = " + node.Url + " | isFolder = " + node.isFolder + " | isMenu = " + node.isMenu + " | isExternal = " + node.isExternal);
if (node != null && node.isFolder) {
var ch = node.children;
if (ch != null && ch !== undefined) {
//Log.logInfo("treeGrid.dataArrived.children.length = " + ch.length);
for (var c = 0; c < ch.length; c++) {
if (ch[c].isFolder)
this.openFolder(ch[c]);
}
}
}
},
nodeClick : function (treeGrid, node, recordNum) {
if (node.Url != null && node.Url.length > 0) {
htmlPane.contentsURL = node.Url;
appArea.showMember(htmlPane);
htmlPane.markForRedraw();
}
}
});
isc.ListGrid.create({
ID: "groupList",
width:"50%", height:"100%",
autoDraw:false,
selectionType:"single",
dataSource:"data1TreeDS",
dataFetchMode: "local",
autoFetchData:false,
overflow:"auto",
canEdit: false,
showHeader: true,
headerHeight: 20,
//headerSpanHeight: 20,
showHeaderMenuButton: false,
border: "1px solid darkgray",
backgroundColor: "white",
layoutAlign: "center",
fields:[
{name:"Name", title: "Name"}
],
gridComponents:["header", "body"],
hideFields: function() {
this.hideField("id");
this.hideField("capId");
this.hideField("parentId");
this.hideField("Url");
this.hideField("isOpen");
this.hideField("isFolder");
this.hideField("isExternal");
this.hideField("isMenu");
this.hideField("isOK");
}
});
isc.Window.create({
ID: "viewWindow",
title: "View",
showTitle: true,
autoDraw: false,
width:"70%", height:"70%",
overflow:"auto",
autoCenter: true,
isModal: true,
showModalMask: true,
modalMaskOpacity: 20,
showCloseButton: true,
showMinimizeButton: false,
showHeaderIcon: false,
vertical: true,
layoutMargin: 10,
membersMargin: 10,
paddingAsLayoutMargin: true,
items: [
isc.HLayout.create({
width:"100%", height:"90%",
autoDraw:false,
overflow:"auto",
layoutMargin: 10,
membersMargin: 10,
members:["groupList"]
}),
isc.LayoutSpacer.create(),
isc.HLayout.create({
width:"100%", height:"10%",
autoDraw:false,
overflow:"hidden",
layoutMargin: 10,
membersMargin: 10,
members:[
isc.LayoutSpacer.create(),
isc.IButton.create({
title:"Close",
autoDraw:false,
icon: "[SKIN]/actions/close.png",
click: function () {
viewWindow.hide();
treeGrid.filterData(
{isOK:true},
function (dsResponse, data, dsRequest) {
},
{willHandleError: true}
);
treeGrid.getData().openAll();
treeGrid.loadDataOnDemand = true;
isc.RPCManager.setPage();
}
})
]
}),
isc.LayoutSpacer.create()
]
});
isc.HTMLPane.create({
ID:"htmlPane",
width:"100%", height:"100%",
autoDraw:false,
contentsType: "page",
overflow:"auto",
showEdges: false
});
isc.IButton.create({
ID:"data1Button",
title:"Set Data1 View",
autoDraw:false,
click: function () {
data2View = false;
var flag = isc.RPCManager.setView(data2View);
if (flag)
treeGrid.getData().openAll();
}
});
isc.IButton.create({
ID:"data2Button",
title:"Set Data2 View",
autoDraw:false,
click: function () {
data2View = true;
var flag = isc.RPCManager.setView(data2View);
if (flag)
treeGrid.getData().openAll();
}
});
isc.IButton.create({
ID:"groupButton",
title:"View Groups",
autoDraw:false,
click: function () {
//data1TreeDS.print(); // >>> TEST ONLY
groupList.filterData(
{isFolder:true, isMenu:false},
function (dsResponse, data, dsRequest) {},
{willHandleError: true}
);
viewWindow.show();
}
});
isc.VLayout.create({
ID:"left",
top: 50,
width:300, height:"100%",
minWidth:200,
autoDraw:false,
overflow:"hidden",
showResizeBar: true,
border: "1px solid darkgray",
members:["treeGrid", "data1Button", "data2Button", "groupButton"]
});
isc.VLayout.create({
ID:"appArea",
width:"100%", height:"100%",
autoDraw:false,
overflow:"hidden",
border:"1px solid darkgray",
members:["htmlPane"]
});
isc.HLayout.create({
ID:"body",
width:"100%", height:"100%",
autoDraw:false,
overflow:"hidden",
border: "1px solid darkgray",
members:["left", "appArea"]
});
isc.VLayout.create({
ID:"mainlayout",
width:"100%", height:"100%",
autoDraw:false,
overflow:"hidden",
members:["body"]
});
isc.RPCManager.addClassProperties({
handleTransportError : function (transactionNum, status, httpResponseCode, httpResponseText) {
//Log.logInfo("RPCManager.handleTransportError.transactionNum = " + transactionNum + ", status = " + status + ", httpResponseCode = " + httpResponseCode + ", httpResponseText = " + httpResponseText);
},
handleError : function (response, request) {
//Log.logInfo("RPCManager.handleError.response = " + response + ", response.status = " + response.status + ", request = " + request + ", request.data = " + request.data);
},
setView : function(data2) {
var dsId = null;
var ds = treeGrid.getDataSource();
if (ds != null && ds !== undefined && ds.ID != null && ds.ID !== undefined)
dsId = ds.ID;
var set = false;
if (data2) {
if (dsId != 'data2TreeDS') {
treeGrid.setDataSource(data2TreeDS);
treeGrid.filterData(
null,
function (dsResponse, data, dsRequest) {},
{willHandleError: true}
);
groupList.setDataSource(data2TreeDS);
groupList.hideFields();
return true;
}
}
else {
if (dsId != 'data1TreeDS') {
treeGrid.setDataSource(data1TreeDS);
treeGrid.filterData(
{isOK:true},
function (dsResponse, data, dsRequest) {},
{willHandleError: true}
);
groupList.setDataSource(data1TreeDS);
groupList.hideFields();
return true;
}
}
return false;
},
setPage : function() {
if (setPageTimer == null) {
setPageTimer = isc.Timer.setTimeout(function() {
if (!initView) {
initView = true;
data2View = false;
isc.RPCManager.setView(data2View);
treeGrid.getData().openAll();
treeGrid.loadDataOnDemand = true;
isc.RPCManager.filterOK();
}
},1000);
}
},
filterOK : function () {
treeGrid.filterData(
{isOK:true},
function (dsResponse, data, dsRequest) {
},
{willHandleError: true}
);
},
refresh : function () {
mainlayout.draw();
for (var data1Index = 0; data1Index < data1.length; data1Index++) {
data1TreeDS.addData(data1[data1Index]);
}
for (var data2Index = 0; data2Index < data2.length; data2Index++) {
data2TreeDS.addData(data2[data2Index]);
}
treeGrid.fetchData(
null,
function (dsResponse, data, dsRequest) {
treeGrid.getData().openAll();
treeGrid.loadDataOnDemand = true;
isc.RPCManager.setPage();
},
{willHandleError: true}
);
}
});
isc.showConsole();
isc.RPCManager.refresh();
</SCRIPT>
</BODY></HTML>
Comment