ExtJS6:将存储绑定到面板项
ExtJS6是否允许将存储绑定到简单的面板项,从而提取指定的列并将其显示为项 { xtype:'面板', id:'主列表', 标题:“主列表”, defaultType:'按钮', 绑定:{ 存储:“{zones}” }ExtJS6:将存储绑定到面板项,extjs,extjs6,extjs6-classic,Extjs,Extjs6,Extjs6 Classic,ExtJS6是否允许将存储绑定到简单的面板项,从而提取指定的列并将其显示为项 { xtype:'面板', id:'主列表', 标题:“主列表”, defaultType:'按钮', 绑定:{ 存储:“{zones}” } }Atm在extJS 6中,面板上的项配置不是可绑定项,这主要是因为在面板上找不到getItem()和setItems()方法。您可以随时覆盖面板并添加该功能,其外观如下所示: Ext.define("Ext.panel.StoreButtonPanel", { /*
}Atm在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();
}
});
可以将存储参数添加到面板中。Extjs将直接加载存储
store:Ext.Create('Yourapp.store.storename'),
No,因为这需要某种记录->组件映射功能。这将是为您自己编写的。您将在稍后定义一个不处理参数的setter时使用自己。试着遵守惯例。关于您的需求,我认为您可以创建一个组件dataview-component,监听存储更改并创建子项