Hi,
I was searching multiple days as how binding from datasource happens to DynamicForm fields. Specifically, I am looking to have binding "select" field, so when user selects option it will update another part of form. The data is provided by RestDataSource.
This is an output from RestDataSource:
This is DynamicForm built:
As you can see above, binding 'cSize' looks like working as expected, though, when I change value what are my options to get matching 'cSizePrice' for given 'cSize'?
Maybe, there is an option to get values directly to variables in javascript from RestDataSource?
This is my 'RestDataSource' fetching values from spring controller:
Please let me know, would you have any suggestions, or perhaps, as I have just started with SmartClient, I might be fundamentally wrong with approaches I use, but would be glad to hear any feedback.
Thanks a lot,
Skuch!
I was searching multiple days as how binding from datasource happens to DynamicForm fields. Specifically, I am looking to have binding "select" field, so when user selects option it will update another part of form. The data is provided by RestDataSource.
This is an output from RestDataSource:
Code:
{ "response": { "status": 0, "data": [ { "cSizePrice": "35.99", "cSize": "SMALL (350mm X 300mm)" }, { "cSizePrice": "59.99", "cSize": "MEDIUM (500mm X 400mm)" }, { "cSizePrice": "79.99", "cSize": "LARGE (750mm x 650mm)" } ] } }
Code:
isc.DynamicForm.create({ ID: "paneNewOrder", itemLayout: "absolute", styleName: "horizontalBottomLine", dataSource: "newDataSource", autoFetchData: true, fields: [ {name: "uplImage", showTitle: false, editorType: "file", left: leftVal, top: topInit}, {name: "btnDelete", title: "Delete Image", editorType: "button", left: leftVal, top: topInit + 25, click: "resetImage()"}, {name: "cSize", title: "Choose Size of Diamond Picture", editorType: "select", left: 50, top: topInit + 120, change: "changeCalculate(?cSizePrice?)"}, // What are options to pass cSizePrice field bound with current 'cSize'? {name: "comment", title: "Comment", editorType: "textArea", width: 500, left: 50, top: topInit + 175}, {name: "submit", title: "Submit", editorType: "submit", left: 640, top: topInit + 280, width: 80} ] });
Maybe, there is an option to get values directly to variables in javascript from RestDataSource?
This is my 'RestDataSource' fetching values from spring controller:
Code:
isc.RestDataSource.create({ ID:"newDataSource", dataFormat:"json", jsonPrefix:"", jsonSuffix:"", operationBindings:[ {operationType:"fetch", dataProtocol:"postParams", dataURL: "<c:url value="${newDataUrl}" />"} ], transformResponse : function (dsResponse, dsRequest, jsonData) { var status = isc.XMLTools.selectObjects(jsonData, "/response/status"); } });
Thanks a lot,
Skuch!
Comment