Hello,
In the sample code, if i add date object to dynamic form, When " this.vwo.valManager.addMember(this.vwo.FrmDuzelt1);" command runs, giving the log "Uncaught TypeError: Cannot read property 'getSavedItemValue' of null "
giving same log when this.vwo.FrmDuzelt1.setValuesManager(this.vwo.valManager);
How do I fix this error?
sample code:
isc.ClassFactory.defineClass("TestForm", isc.VLayout);
isc.TestForm.addProperties({
height: "100%",
width: "100%",
showResizeBar: false,
autoDraw: false,
//---
vwObjects: {},
treeObj: {},
setForm: function () {
mainLayout: this;
var dsFields = [
{ name: "ID", title: "Id Key", primaryKey: true },
{ name: "DOGTAR", title: "Doğum Tarihi", type: "date" },
{ name: "ADSAD", title: "Adı Soyadı" }
];
dsOperationBindings = [];
dsOperationBindings.push({ operationType: "fetch", dataProtocol: "postMessage", dataURL: "../CRUD/GetData" });
dsOperationBindings.push({ operationType: "remove", dataProtocol: "postMessage", dataURL: "../CRUD/DeleteData" });
dsOperationBindings.push({ operationType: "add", dataProtocol: "postMessage", dataURL: "../CRUD/InsertData" });
dsOperationBindings.push({ operationType: "update", dataProtocol: "postMessage", dataURL: "../CRUD/UpdateData" });
dsOperationBindings.push({ operationType: "validate", dataProtocol: "postMessage", dataURL: "../CRUD/ValidateData" });
this.vwObjects.ds = isc.RestDataSource.create({
dataFormat: "json",
fields: dsFields,
criteriaPolicy: "dropOnChange",
jsonPrefix: "//'"]]>>isc_JSONResponseStart>>",
jsonSuffix: '//isc_JSONResponseEnd',
operationBindings: dsOperationBindings,
validateRelatedRecords: true,
transformResponse: function (dsResponse, dsRequest, data) {
var dsResponse = this.Super("transformResponse", arguments);
// ... do something to dsResponse ...
return dsResponse;
},
transformRequest: function (dsRequest) {
// modify dsRequest.data here, for example, add fixed criteria
if (!dsRequest.data) {
dsRequest.data = {};
}
dsRequest.data.programName = "dem201";
dsRequest.data.programDataSource = "L_CARMASF";
return this.Super("transformRequest", arguments);
},
handleError: function (response, request) {
if (response.data) {
isc.Dialog.create({
message: "<b>" + status[response.status.toString()] + ": " + response.data.MainMessage + "<br><br>Hata Detayı:<br></b>" + response.data.Details,
icon: "../../Images/System/error.png",
isModal: true,
title: "UYARI",
buttons: [
isc.Button.create({ title: "OK" }),
],
buttonClick: function (button, index) {
this.destroy();
}
});
return false;
}
return true;
}
});
this.vwObjects.tmpGrid = isc.ListGrid.create({
vwo: this.vwObjects,
autoDraw: false,
fields: dsFields,
alternateRecordStyles: true,
autoFitFieldWidths: true,
width: "100%",
height: "100%",
dataSource: this.vwObjects.ds
});
this.vwObjects.tmpButton = isc.IButton.create({
vwo: this.vwObjects,
autoDraw: false,
title: "Görüntüle",
width: 150,
click: function () { this.vwo.tmpGrid.fetchData(); }
});
this.vwObjects.tmpButton2 = isc.IButton.create({
vwo: this.vwObjects,
autoDraw: false,
title: "Düzelt",
width: 150,
click: function () {
if (!this.vwo.valManager) {
this.vwo.valManager = isc.ValuesManager.create({
dataSource: this.vwo.ds
});
}
var tmpRecord = this.vwo.tmpGrid.getSelectedRecord();
//this.vwo.FrmDuzelt1.setValuesManager(this.vwo.valManager);
this.vwo.tmpForm.setValuesManager(this.vwo.valManager);
if (tmpRecord) {
this.vwo.tmpForm.setVisibility("visible");
this.vwo.valManager.editRecord(tmpRecord);
this.vwo.tmpGrid.setShowResizeBar(true);
}
}
});
this.vwObjects.tmpForm = isc.DynamicForm.create({
vwo: this.vwObjects,
width: 400,
visibility: "hidden"
});
var tmpObj = FormObjects["Date"]();
tmpObj.addProperty("name", "DOGTAR");
tmpObj.addProperty("title", "Doğum Tarihi");
this.vwObjects.field1 = tmpObj.getObj(this.vwObjects); //{ name: "DOGTAR", title: "Doğum Tarihi", type: "date", useTextField: true };
this.vwObjects.field2 = { name: "ADSAD", title: "Adı Soyadı" };
this.vwObjects.tmpForm.addField(this.vwObjects.field1);
this.vwObjects.tmpForm.addField(this.vwObjects.field2);
this.addMember(this.vwObjects.tmpButton);
this.addMember(this.vwObjects.tmpButton2);
this.addMember(this.vwObjects.tmpButton3);
this.addMember(this.vwObjects.tmpGrid);
this.addMember(this.vwObjects.tmpForm);
},
initWidget: function () {
this.Super("initWidget", arguments);
this.setForm();
this.draw();
}
});
var tmpForm = isc.TestForm.create();
In the sample code, if i add date object to dynamic form, When " this.vwo.valManager.addMember(this.vwo.FrmDuzelt1);" command runs, giving the log "Uncaught TypeError: Cannot read property 'getSavedItemValue' of null "
giving same log when this.vwo.FrmDuzelt1.setValuesManager(this.vwo.valManager);
How do I fix this error?
sample code:
isc.ClassFactory.defineClass("TestForm", isc.VLayout);
isc.TestForm.addProperties({
height: "100%",
width: "100%",
showResizeBar: false,
autoDraw: false,
//---
vwObjects: {},
treeObj: {},
setForm: function () {
mainLayout: this;
var dsFields = [
{ name: "ID", title: "Id Key", primaryKey: true },
{ name: "DOGTAR", title: "Doğum Tarihi", type: "date" },
{ name: "ADSAD", title: "Adı Soyadı" }
];
dsOperationBindings = [];
dsOperationBindings.push({ operationType: "fetch", dataProtocol: "postMessage", dataURL: "../CRUD/GetData" });
dsOperationBindings.push({ operationType: "remove", dataProtocol: "postMessage", dataURL: "../CRUD/DeleteData" });
dsOperationBindings.push({ operationType: "add", dataProtocol: "postMessage", dataURL: "../CRUD/InsertData" });
dsOperationBindings.push({ operationType: "update", dataProtocol: "postMessage", dataURL: "../CRUD/UpdateData" });
dsOperationBindings.push({ operationType: "validate", dataProtocol: "postMessage", dataURL: "../CRUD/ValidateData" });
this.vwObjects.ds = isc.RestDataSource.create({
dataFormat: "json",
fields: dsFields,
criteriaPolicy: "dropOnChange",
jsonPrefix: "//'"]]>>isc_JSONResponseStart>>",
jsonSuffix: '//isc_JSONResponseEnd',
operationBindings: dsOperationBindings,
validateRelatedRecords: true,
transformResponse: function (dsResponse, dsRequest, data) {
var dsResponse = this.Super("transformResponse", arguments);
// ... do something to dsResponse ...
return dsResponse;
},
transformRequest: function (dsRequest) {
// modify dsRequest.data here, for example, add fixed criteria
if (!dsRequest.data) {
dsRequest.data = {};
}
dsRequest.data.programName = "dem201";
dsRequest.data.programDataSource = "L_CARMASF";
return this.Super("transformRequest", arguments);
},
handleError: function (response, request) {
if (response.data) {
isc.Dialog.create({
message: "<b>" + status[response.status.toString()] + ": " + response.data.MainMessage + "<br><br>Hata Detayı:<br></b>" + response.data.Details,
icon: "../../Images/System/error.png",
isModal: true,
title: "UYARI",
buttons: [
isc.Button.create({ title: "OK" }),
],
buttonClick: function (button, index) {
this.destroy();
}
});
return false;
}
return true;
}
});
this.vwObjects.tmpGrid = isc.ListGrid.create({
vwo: this.vwObjects,
autoDraw: false,
fields: dsFields,
alternateRecordStyles: true,
autoFitFieldWidths: true,
width: "100%",
height: "100%",
dataSource: this.vwObjects.ds
});
this.vwObjects.tmpButton = isc.IButton.create({
vwo: this.vwObjects,
autoDraw: false,
title: "Görüntüle",
width: 150,
click: function () { this.vwo.tmpGrid.fetchData(); }
});
this.vwObjects.tmpButton2 = isc.IButton.create({
vwo: this.vwObjects,
autoDraw: false,
title: "Düzelt",
width: 150,
click: function () {
if (!this.vwo.valManager) {
this.vwo.valManager = isc.ValuesManager.create({
dataSource: this.vwo.ds
});
}
var tmpRecord = this.vwo.tmpGrid.getSelectedRecord();
//this.vwo.FrmDuzelt1.setValuesManager(this.vwo.valManager);
this.vwo.tmpForm.setValuesManager(this.vwo.valManager);
if (tmpRecord) {
this.vwo.tmpForm.setVisibility("visible");
this.vwo.valManager.editRecord(tmpRecord);
this.vwo.tmpGrid.setShowResizeBar(true);
}
}
});
this.vwObjects.tmpForm = isc.DynamicForm.create({
vwo: this.vwObjects,
width: 400,
visibility: "hidden"
});
var tmpObj = FormObjects["Date"]();
tmpObj.addProperty("name", "DOGTAR");
tmpObj.addProperty("title", "Doğum Tarihi");
this.vwObjects.field1 = tmpObj.getObj(this.vwObjects); //{ name: "DOGTAR", title: "Doğum Tarihi", type: "date", useTextField: true };
this.vwObjects.field2 = { name: "ADSAD", title: "Adı Soyadı" };
this.vwObjects.tmpForm.addField(this.vwObjects.field1);
this.vwObjects.tmpForm.addField(this.vwObjects.field2);
this.addMember(this.vwObjects.tmpButton);
this.addMember(this.vwObjects.tmpButton2);
this.addMember(this.vwObjects.tmpButton3);
this.addMember(this.vwObjects.tmpGrid);
this.addMember(this.vwObjects.tmpForm);
},
initWidget: function () {
this.Super("initWidget", arguments);
this.setForm();
this.draw();
}
});
var tmpForm = isc.TestForm.create();
Comment