Ext.Data.Json
Code
1 var dd = [["a", "BeiJing"], ["b", "ShangHai"], ["c", "Changsha"], ["d", "Changchun"], ["e", "Kunming"]];
2 var data = new Ext.data.SimpleStore({
3 fields: ["name", "nick"],
4 data: dd
5 });
6 //alert(data.getAt(0).get("nick"));
7
8 var json = { total: 2, rows: [{ name: "gzb", age: 20 }, { name: "gjh", age: 3}] };
9
10 var ds = new Ext.data.Store({
11 //data: json,
12 proxy: new Ext.data.MemoryProxy(json),
13 reader: new Ext.data.JsonReader({
14 totalProperty: "total",
15 root: "rows",
16 id: "id",
17 fields: [{ name: "name" }, { name: "age"}]
18 }
19 )
20 });
21 ds.load();
22 //alert(ds.getCount());
23 var combobox = new Ext.form.ComboBox({ displayField: "name", forceSelection: true, triggerAction: 'all', mode: "local", store: ds, title: "Select City", selectOnFocus: true, valueNotFoundText: "NotFoundText", id: "abc" });
24 combobox.render(document.body);
25 var combobox2 = combobox.cloneConfig();
26 combobox2.title = "ad";
27 combobox2.render(document.body);
1 var dd = [["a", "BeiJing"], ["b", "ShangHai"], ["c", "Changsha"], ["d", "Changchun"], ["e", "Kunming"]];
2 var data = new Ext.data.SimpleStore({
3 fields: ["name", "nick"],
4 data: dd
5 });
6 //alert(data.getAt(0).get("nick"));
7
8 var json = { total: 2, rows: [{ name: "gzb", age: 20 }, { name: "gjh", age: 3}] };
9
10 var ds = new Ext.data.Store({
11 //data: json,
12 proxy: new Ext.data.MemoryProxy(json),
13 reader: new Ext.data.JsonReader({
14 totalProperty: "total",
15 root: "rows",
16 id: "id",
17 fields: [{ name: "name" }, { name: "age"}]
18 }
19 )
20 });
21 ds.load();
22 //alert(ds.getCount());
23 var combobox = new Ext.form.ComboBox({ displayField: "name", forceSelection: true, triggerAction: 'all', mode: "local", store: ds, title: "Select City", selectOnFocus: true, valueNotFoundText: "NotFoundText", id: "abc" });
24 combobox.render(document.body);
25 var combobox2 = combobox.cloneConfig();
26 combobox2.title = "ad";
27 combobox2.render(document.body);