I had a look at this thread again as I saw unexpected DynamicForm-FormItem fetches in recent 12.0p, but it turned out to be my mistake.
I did see changes in v12.0p_2019-08-08, though. First of all, there seems to be a (recent?) improvement, where you don't do a SelectItem fetchMissingValueReply-request, when the data is in the pickList's fetchRemoteDataReply. Pretty cool. I saw this in the 2nd DynamicForm and to see the difference one has to change sort direction of the 2nd DynamicForm's initialSort.
If you wanted to improve this even further (absolutely no priority for me) you could also wait with the fetchRemoteDataReply-request you get in the 1st DynamicForm on "canEdit"-Button click until the DynamicForm is both, canEdit:true and disabled:false.
Showcase sample:
Code:
isc.DynamicForm.create({ ID: "dynamicForm", dataSource: "employees", canEdit:false, readOnlyDisplay:"static", disabled:true, width: 800, fields:[ {name: "header", type:"header", value:"Form 1"}, {name: "userOrder"}, {name: "EmployeeId"}, {name: "ReportsTo", editorType:"SelectItem", optionDataSource:"employees", valueField:"EmployeeId", displayField:"Name", fetchDisplayedFieldsOnly:true, pickListWidth:350, pickListFields:[ {name:"Name"}, {name:"Email"} ], pickListProperties: { drawAllMaxCells: 1, initialSort: [ {property: "Name", direction: "descending"}, {property: "Email", direction: "descending"} ] } }, {name: "Job"}, {name: "Email"}, {name: "EmployeeType"}, {name: "EmployeeStatus"}, {name: "Salary"}, {name: "OrgUnit"}, {name: "Gender"}, {name: "MaritalStatus"}, ] }); isc.DynamicForm.create({ ID: "dynamicForm2", dataSource: "employees", width: 800, fields:[ {name: "header", type:"header", value:"Form 2 with ommited fetchMissingValueReply"}, {name: "userOrder"}, {name: "EmployeeId"}, {name: "ReportsTo", editorType:"SelectItem", optionDataSource:"employees", valueField:"EmployeeId", displayField:"Name", fetchDisplayedFieldsOnly:true, pickListWidth:350, pickListFields:[ {name:"Name"}, {name:"Email"} ], pickListProperties: { drawAllMaxCells: 1, initialSort: [ {property: "Name", direction: "ascending"}, // One request more with descending {property: "Email", direction: "ascending"} ] } }, {name: "Job"}, {name: "Email"}, {name: "EmployeeType"}, {name: "EmployeeStatus"}, {name: "Salary"}, {name: "OrgUnit"}, {name: "Gender"}, {name: "MaritalStatus"}, ] }); isc.IButton.create({ ID: "toggleEditBtn", title: "Toggle canEdit", click: "dynamicForm.setCanEdit(!dynamicForm.canEdit)" }); isc.IButton.create({ ID: "toggleDisabledBtn", title: "Toggle disabled", click: "dynamicForm.setDisabled(!dynamicForm.disabled)" }); isc.IButton.create({ ID:"printBtn", autoDraw: false, title: "Print Preview", click: "isc.Canvas.showPrintPreview([dynamicForm])" }); isc.HStack.create({ ID: "buttons", height: 24, membersMargin: 10, members: [toggleEditBtn, toggleDisabledBtn, printBtn] }); isc.VLayout.create({ width: 800, membersMargin: 10, members: [buttons, dynamicForm, dynamicForm2] }); dynamicForm.fetchData({ fieldName: "EmployeeId", operator: "equals", value: "192" }); dynamicForm2.fetchData({ fieldName: "EmployeeId", operator: "equals", value: "192" });
Blama
Leave a comment: