I have one application with 2 data sources.
one off the datasources is bound to a grid. The second datasource is an 'optiondatasource' for a listGridField. When i start editing a row the server is contacted 2 or more times to receive the data for the selection list. The resultset is always the same. What is wrong with my code.
the url for testing is:
https://www.virtic24.com/cgi-bin/cgiip.exe/WService=virtictest/eventmaint2a.p
Below is my code :
regards Paul
one off the datasources is bound to a grid. The second datasource is an 'optiondatasource' for a listGridField. When i start editing a row the server is contacted 2 or more times to receive the data for the selection list. The resultset is always the same. What is wrong with my code.
the url for testing is:
https://www.virtic24.com/cgi-bin/cgiip.exe/WService=virtictest/eventmaint2a.p
Below is my code :
regards Paul
Code:
<!-- **************************************************************************** -->
<!-- FILE: web/
<!-- **************************************************************************** -->
<HTML>
<HEAD>
<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/SmartClient/load_skin.js></SCRIPT>
</HEAD>
<BODY BGCOLOR='papayawhip' MARGINHEIGHT=0 MARGINWIDTH=0 LEFTMARGIN=0 TOPMARGIN=0>
<SCRIPT>
isc.DataSource.create({
title:"Baustelle",
ID:"vtBaustelle",
recordXPath:"//bst",
dataFormat:"xml",
dataProtocol: "postParams",
dataURL:"baustelle_pl.p",
autoFetchData:false,
transformRequest : function (dsRequest) {
dsRequest.contentType = "application/x-www-form-urlencoded; charset=UTF-8";
var params = {
aktion : "fetch"
};
return isc.addProperties({}, dsRequest.data, params);
},
transformResponse : function (dsResponse, dsRequest, jsonData) {
var status = isc.XMLTools.selectString(jsonData, "//status");
if (status != "0") {
dsResponse.status = isc.RPCResponse.STATUS_VALIDATION_ERROR;
var errors = isc.XMLTools.selectNodes(jsonData, "//error");
dsResponse.errors = isc.XMLTools.toJS(errors);
isc.say (dsResponse.errors);
}
else dsResponse.status = 0;
dsResponse.totalRows = isc.XMLTools.selectNumber(jsonData, "//totalRows");
return dsResponse;
},
fields:{
bstObjId:{
type:"text",
title:"bstObjId",
name:"bstObjId",
length:10,
required: true,
hidden: true,
primaryKey:true
},
bstBez:{
type:"text",
title:"Name",
name:"Name",
length:30
}
}
});
isc.DataSource.create({
title:"Ereignisse",
ID:"vtMarevent",
recordXPath:"//ereignis",
dataFormat:"xml",
dataProtocol: "getParams",
dataURL:"event_pl.p",
selectionType:"single",
transformRequest : function (dsRequest) {
dsRequest.contentType = "application/x-www-form-urlencoded; charset=UTF-8";
var aktion = "fetch";
if (dsRequest.operationType == "fetch") {
var params = {
aktion : aktion
};
return isc.addProperties({}, dsRequest.data, params);
}
if (dsRequest.operationType == "update") {
var fieldName = Listmar.getFieldName(0);
var row = Listmar.getSelectedRecord();
var params = {
aktion : "Update"
};
return isc.addProperties({}
, dsRequest.data
, dsRequest.Values
, params
);
}
},
transformResponse : function (dsResponse, dsRequest, jsonData) {
var status = isc.XMLTools.selectString(jsonData, "//status");
if (status != "0") {
dsResponse.status = isc.RPCResponse.STATUS_VALIDATION_ERROR;
var errors = isc.XMLTools.selectNodes(jsonData, "//error");
dsResponse.errors = isc.XMLTools.toJS(errors);
isc.say (dsResponse.errors);
}
else dsResponse.status = 0;
return dsResponse;
},
fields:{
maeObjId:{
type:"text",
title:"Id",
name:"maeObjId",
length:25,
required:true,
hidden: true,
primaryKey:true
},
Zeit:{
type:"time",
title:"Zeit",
name:"Zeit",
timeFormatter: "toPadded24HourTime",
canEdit: true,
length:10,
canSort:false
},
Baustelle:{
type:"text",
title:"Baustelle",
hidden: true,
name:"Baustelle",
canSort:false,
length:30
},
bstObjId:{
type:"text",
title:"Baustelle",
name:"bstObjId",
type: "text",
editorType: "select",
length:30,
canEdit: true,
displayField:"bstBez",
valueField:"bstObjId",
optionDataSource:"vtBaustelle",
showOptionsFromDataSource: true ,
/*
editorProperties : {
optionDataSource:"vtBaustelle",
displayField:"baustelle",
valueField:"bstObjId",
showOptionsFromDataSource: true,
//canSort:false,
//canFilter:false,
pickListWidth:300,
pickListFields: [
{ name:"bstBez" },
{ name:"bstObjId" }
],
},
*/
pickListFields: [
{ name:"bstBez" },
{ name:"bstObjId" }
],
formatCellValue: function (value, record) {
return record.Baustelle;
} ,
formatEditorValue: function (value, record) {
return record.Baustelle;
}
}
}
});
isc.ListGrid.create({
dataSource:vtMarevent,
ID:"Listmar",
autoFetchData:true,
sortable:false,
dataPageSize: 50,
autoDraw:true,
alternateRecordStyles:true,
canEdit:true,
modalEditing:true,
selectionType: "single",
autoSaveEdits : true,
dateFormatter: "toEuropeanShortDateTime",
timeFormatter: "toPadded24HourTime",
DateInputFormat: "DMY"
});
isc.HLayout.create({
ID:"pageLayout",
width:"100%",
height:"100%",
members:[
isc.SectionStack.create({
ID:"rightSideLayout",
backgroundColor:"white",
visibilityMode:"multiple",
height:"100%",
animateSections:true,
sections:[
{title:"Ereignisse", autoShow:true, items:[Listmar]}
]
})
]
});
</SCRIPT>
</BODY>
</HTML>
Comment