1)若使用Store.loadData()方法,则在 Ext.create("Ext.data.Store",{data:...})中必须定义data字段。
2)注意定义Store时,配置data时的属性名(即下面的styleNo)
Ext.create("Ext.data.Store",{ id:"styleNoStore", fields:[ "styleNo" ], data:[{"styleNo":"a"},{"styleNo":"b"}] // data:[["a"],["b"]] //这个和{xtype:"combo",fieldLabel:"View Style",name:"accessory.styleNo",id:"accessory.styleNo", store:styleNoStore,field:"styleNo", emptyText:"Please select!", allowBlank:false,forceSelection:true,anchor:"100%" }一起配置后,不正常。不能显示值。正确写法需使用ArrayStore,而不是Store,如下 });
Ext.create("Ext.data.ArrayStore",{ id:"styleNoStore", fields:[ {name:"styleNo"} ], data:[["a"],["b"]] });
3)第一次动态加载comboBox下拉值失败问题
Ext.create("Ext.data.Store",{ id:"styleNoStore", fields:[ "styleNo" ], data:[] });
上面这种不写出fields的name属性的方式,在snStore.loadData([["a"],["b1"]]);时,会出现第一次动态加载的值不显示
Ext.create("Ext.data.Store",{ id:"styleNoStore", fields:[ {name:"styleNo"} ], data:[] });
这种写法在snStore.loadData([{"styleNo":"Genneral"},{"styleNo":"L11-032"}]);时,则不会有上述问题。
4)snStore.loadData()前必须先snStore.removeAll(),不然第一次动态加载comboBox的下载数据会无效。
lastQuery:''
增加上面的配置项,可以解决此bug。
摘自:[url]
http://www.cnitblog.com/yemoo/archive/2009/07/28/44724.html[/url]
5)两种方式获取store
a)
Ext.create("Ext.data.Store",{ id:"styleNoStore"; fields:[ {name:"styleNo"} ], data:[] }); var snStore=Ext.StoreManager.lookup("styleNoStore");
b)
var styleNoStore= Ext.create("Ext.data.Store",{ fields:[ {name:"styleNo"} ], data:[] }); styleNoStore.loadData(eval("("+accessory.styleNo+")"));
6)
{xtype:"grid", store:"accessoryBillStore", /*height:500,与"父面板的height值相互影响,在点击grid中的数据行时,页面显示会起变化。(首次加载时,grid的高度若小于500,则在点击grid中的数据行后,grid的高度会变成500.)"*/ scroll: true,//'horizontal','vertical','both'(同true); width:1000,//IE8中若不配置width,显示不了grid的数据。 ....... }