javascript - How to fill an Ext.form.CheckboxGroup with checkboxes generated based on a JSON object returned from a server -
I dynamically try to fill I can load these items in the code in the I understand that it will give me access to a set of I am not trying to set the checkbox values, although I must be able to reference them while submitting the form. Assume that the store is loading (since you have automatically loaded: true) Snippet to create and configure a checkbox - Add it to your container and recreate it - Ext.form.CheckboxGroup to
Ext I am here. Form derived from JSON object pulled from JSF page Checkbox s looks like my JSON object:
{"sensor": [{"id": 200, "name": "name - b - a"}, {"Id": 201, "name": "name -b -b"}, {"id": 202, "name": "name-c -a"}, {"id": 203, "name" : "Name-c -b"}]}
Ext.data.JsonStore in such a way: / P>
New Ext.data.JsonStore ({id: 'sensorstore', auto-load: correct, method: 'GET', base-based: {job type: 'sensor'}, url: ' Getstatus.jsp ', root:' sensor ', sortoinfo: field: [' id ',' name ']}),
Ext.data.Record objects, but I can not understand that any
Ext.form.Checkbox s How to go about making those records go about, or if there is any other way to get the same results.
var Checkbox configured = []; About the check box // array Mystore.getRange (). Each (function (record) {checkboxconfigs.push (push in // // array ID: record.data.id, boxLabel: record.data.name, // any other checkbox properties, layout related or whatever});} ); Snippet to create a checkbox group -
var myCheckboxgroup = new Ext.form.CheckboxGroup ({id: 'myGroup', fieldLabel: 'check box in two columns', column: 2, item: checkbox Configure / // // other checkbox group configuration in the previous snippet});
mycontainer.add (myCheckboxgroup) .doLayout (); Edit - Your JasonStore does not match configured data (id should be an integer)
New Ext.data.JsonStore ({ Id: 'sensor', auto-load: correct, method: 'GET' Id ', direction:' ASC '}, field: [{name:' id ', type: int},' name ']}),
Comments
Post a Comment