Given a SelectItem based on a three-column DataSource where
- the first column represents a code category
- the second a valid code for each category (and possibly duplicated across categories)
- a description
Code:
isc.DataSource.create({ ID: "testDS", fields:[ {name:"pid", primaryKey: true, hidden:true}, {name:"category", title:"Category"}, {name:"option", title:"Option"}, {name:"name", title:"Name"} ], clientOnly: true, cacheData: [ {pid: 1, category: "A", option: "A", name: "Cat A Opt A"}, {pid: 2, category: "A", option: "B", name: "Cat A Opt B"}, {pid: 3, category: "A", option: "C", name: "Cat A Opt C"}, {pid: 4, category: "A", option: "D", name: "Cat A Opt D"}, {pid: 5, category: "B", option: "D", name: "Cat B Opt A"}, {pid: 6, category: "B", option: "D", name: "Cat B Opt B"}, {pid: 7, category: "B", option: "D", name: "Cat B Opt C"}, {pid: 8, category: "B", option: "D", name: "Cat B Opt D"} ] }) isc.defineClass("OptSelect", "SelectItem").addProperties({ optionDataSource:"testDS", valueField: "option", displayField: "name", pickListFields:[{name:"option", width:20},{name:"name",width:100}], width: 140, filterLocally: true, sortField:"option" }); isc.DynamicForm.create({ ID:"testForm", width: 500, fields : [ { name:"option", editorType:"OptSelect", pickListCriteria: {category: "A"} } ] });
Comment