ExtJS6是否允许存储绑定到简单面板项,以便提取指定列并将它们显示为项{ xtype:' panel ',id:'master_list',title:'MasterList',defaultType:'button',绑定:{ store:'{zones}‘}}
发布于 2017-01-06 01:59:16
在extJS 6中,面板上的项配置不是可绑定项,这主要是因为在面板上找不到getItem()和setItems()方法。您可以随时重写面板并添加该功能,它将如下所示:
Ext.define("Ext.panel.StoreButtonPanel", {
/* extend a panel so you get same base functionality of a panel */
extend: 'Ext.panel.Panel',
/* other configs and overrides you might want */
setStore:function(){
// function to bind the store to panel
},
getStore:function(){
// function to get store from panel
}
setItems: fuunction(){
var me = this,
myStore = me.getStore();
// loop through store and add items.
myStore.each(function(storeItem){
// create the items that you want from teh store via loop and using
// storeItem
Ext.create('Ext.button.Button', {
text: storeItem.get('text'),
/* other things here if needed */
})
});
},
init: function(){
var me = this;
// call method to create items if a store is found.
if(me.getStore()){
me.setItems();
}
me.callParent();
}
});发布于 2017-03-16 21:32:23
您可以将store参数添加到您的面板。Extjs将直接加载存储。
store: Ext.Create('Yourapp.store.storename'),
https://stackoverflow.com/questions/41489659
复制相似问题