We wish to have embedded widgets inside a single tree cell. To do so I use "createRecordComponent()" method which returns a field with combined widgets
In the code below I create tree field made of isc.Label and isc.ImgButton. However, this is a concrete example with hardcoded widgets and source. I have difficulty figuring out how to bind widget to the source if widget can be named anything and its source can be any field in the record.
Any advice?
Thank you
<HTML><HEAD><TITLE>Combined Fields Inquiry</TITLE>
</HEAD>
<body class="pageBackground" marginwidth="0" marginheight="0" topmargin="0" leftmargin="0" scroll="no" style="overflow:hidden">
<SCRIPT>var isomorphicDir = "isomorphic/"</SCRIPT>
<SCRIPT>var isomorphicDir = "isomorphic/"</SCRIPT>
<SCRIPT SRC=isomorphic/system/modules/ISC_Core.js></SCRIPT>
<SCRIPT SRC=isomorphic/system/modules/ISC_Foundation.js></SCRIPT>
<SCRIPT SRC=isomorphic/system/modules/ISC_Containers.js></SCRIPT>
<SCRIPT SRC=isomorphic/system/modules/ISC_Grids.js></SCRIPT>
<SCRIPT SRC=isomorphic/system/modules/ISC_Forms.js></SCRIPT>
<SCRIPT SRC=isomorphic/system/modules/ISC_DataBinding.js></SCRIPT>
<SCRIPT SRC=isomorphic/skins/Enterprise/load_skin.js></SCRIPT>
<script>
countryData = [
{ continent:"North America",
countryName:"United States",
countryCode:"US"},
{ continent:"Asia",
countryName:"China",
countryCode:"CH"},
{ continent:"Asia",
countryName:"Japan",
countryCode:"JA"},
{ continent:"Asia",
countryName:"India",
countryCode:"IN"},
{ continent:"Europe",
countryName:"Germany",
countryCode:"GM"},
{ continent:"Europe",
countryName:"United Kingdom",
countryCode:"UK"},
{ continent:"Europe",
countryName:"France",
countryCode:"FR"}
]
isc.ListGrid.create({
height: 200,
showRecordComponents: true,
showRecordComponentsByCell: true,
canRemoveRecords: true,
data: countryData,
fields: [{ name: "iconField", title: "Comments/Stats", width: 100 }],
createRecordComponent : function (record, colNum) {
var fieldName = this.getFieldName(colNum);
if (fieldName == "iconField") {
var recordCanvas = isc.HLayout.create({
height: 22,
align: "center"
});
var flagImg = isc.ImgButton.create({
src:"/isomorphic/system/reference/exampleImages/flags/16/" + record["countryCode"] + ".png",
height: 16,
width: 16
});
var countryLbl = isc.Label.create({
contents: record["countryName"]
});
recordCanvas.addMember(flagImg);
recordCanvas.addMember(countryLbl);
return recordCanvas;
}
return null;
}
});
</script>
</BODY>
</html>
In the code below I create tree field made of isc.Label and isc.ImgButton. However, this is a concrete example with hardcoded widgets and source. I have difficulty figuring out how to bind widget to the source if widget can be named anything and its source can be any field in the record.
Any advice?
Thank you
<HTML><HEAD><TITLE>Combined Fields Inquiry</TITLE>
</HEAD>
<body class="pageBackground" marginwidth="0" marginheight="0" topmargin="0" leftmargin="0" scroll="no" style="overflow:hidden">
<SCRIPT>var isomorphicDir = "isomorphic/"</SCRIPT>
<SCRIPT>var isomorphicDir = "isomorphic/"</SCRIPT>
<SCRIPT SRC=isomorphic/system/modules/ISC_Core.js></SCRIPT>
<SCRIPT SRC=isomorphic/system/modules/ISC_Foundation.js></SCRIPT>
<SCRIPT SRC=isomorphic/system/modules/ISC_Containers.js></SCRIPT>
<SCRIPT SRC=isomorphic/system/modules/ISC_Grids.js></SCRIPT>
<SCRIPT SRC=isomorphic/system/modules/ISC_Forms.js></SCRIPT>
<SCRIPT SRC=isomorphic/system/modules/ISC_DataBinding.js></SCRIPT>
<SCRIPT SRC=isomorphic/skins/Enterprise/load_skin.js></SCRIPT>
<script>
countryData = [
{ continent:"North America",
countryName:"United States",
countryCode:"US"},
{ continent:"Asia",
countryName:"China",
countryCode:"CH"},
{ continent:"Asia",
countryName:"Japan",
countryCode:"JA"},
{ continent:"Asia",
countryName:"India",
countryCode:"IN"},
{ continent:"Europe",
countryName:"Germany",
countryCode:"GM"},
{ continent:"Europe",
countryName:"United Kingdom",
countryCode:"UK"},
{ continent:"Europe",
countryName:"France",
countryCode:"FR"}
]
isc.ListGrid.create({
height: 200,
showRecordComponents: true,
showRecordComponentsByCell: true,
canRemoveRecords: true,
data: countryData,
fields: [{ name: "iconField", title: "Comments/Stats", width: 100 }],
createRecordComponent : function (record, colNum) {
var fieldName = this.getFieldName(colNum);
if (fieldName == "iconField") {
var recordCanvas = isc.HLayout.create({
height: 22,
align: "center"
});
var flagImg = isc.ImgButton.create({
src:"/isomorphic/system/reference/exampleImages/flags/16/" + record["countryCode"] + ".png",
height: 16,
width: 16
});
var countryLbl = isc.Label.create({
contents: record["countryName"]
});
recordCanvas.addMember(flagImg);
recordCanvas.addMember(countryLbl);
return recordCanvas;
}
return null;
}
});
</script>
</BODY>
</html>
Comment