2017-01-05 8 views
1

ないExtJS6は、ストアは単純なパネルのアイテムに結合することができ、それは指定された列を駆り立てるような項目 { XTYPEとして表示:「パネル」 ID:「master_list」 タイトル: 'MasterList' DefaultTypeで指定: 'ボタン' は、 バインド:{ 店舗: '{ゾーン}' } }ExtJS6:結合ストアパネル項目に

+0

いいえ、それはレコードのいくつかの種類が必要となるので - >コンポーネントのマッピング機能を。これは自分のために書くものです。 –

答えて

1

ExtJSの6におけるATM、パネル上の項目の設定は、主に、バインド可能な項目ではありませんこれは、パネルに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(); 
    } 
}); 
+0

パラメータを扱わないセッターを定義するときには、後で自分自身を解読します。大会に従ってください。あなたの要件については、私はあなたがコンポーネントのデータビューを作成することができると思う - コンポーネントの変更を格納し、子アイテムを作成する – bigopon

0

パネルにストアパラメータを追加できます。 Extjsはストアを直接ロードします。

store: Ext.Create('Yourapp.store.storename'),

関連する問題