2

こんにちは!

このハンドラー「handler: onEventControler (???)」をビューから削除したい (そこに属していない)

グリッド ビュー セット dockedItems の場合、このタラ:

        this.dockedItems = [{
        xtype: 'toolbar',
        items: [{
            xtype: 'newstation'
        },{
            id: 'add-persone-btn',
            xtype: 'button',
            itemId: 'add',
            text: 'Add',
            iconCls: 'icon-add',  
            handler: onEventControler(???)
        }, '-', {
            itemId: 'delete',
            text: 'Delete',
            iconCls: 'icon-delete',
            disabled: true,
            handler: function(){
                var selection = grid.getView().getSelectionModel().getSelection()[0];
                if (selection) {
                    store.remove(selection);
                }
            }
        }]
    }]

this.controlも実装しようとしましたが、ボタンの selectorQuery を要求できませんでした。

アーキテクチャmvc extJs4を適切に尊重するにはどうすればよいですか?

ありがとうございました。

4

2 に答える 2

1

このビューのコントローラー内でこのようなことができるはずです。

init: function () {
  this.control({
    'toolbar #add': {
      click: this.onAddStation
    }        
  });
}

ハンドラ:

onAddStation: function(button, e, eOpts){
  //Handle
}

または、ボタンで「アクション」構成を使用することもできます。

action: 'addstation'

次に、次のことができます。

init: function () {
  this.control({
    'button[action=addstation]': {
      click: me.onAddStation
    }        
  });
}

http://docs.sencha.com/ext-js/4-0/#!/api/Ext.button.Button

于 2012-02-19T18:04:30.827 に答える
0

これはビュー gridd ビューのメソッド「initComponent」です。

initComponent: function () {
    this.plugins = [Ext.create('Ext.grid.plugin.RowEditing')];

    this.dockedItems = [{
        xtype: 'toolbar',
        items: [{
            xtype: 'button',
            itemId: 'add',
            text: 'Add',
            iconCls: 'icon-add',
            action: 'add-new-persone'
        }, '-', {
            itemId: 'delete',
            text: 'Delete',
            iconCls: 'icon-delete',
            action: 'delete-persone',
            disabled: true
        }, '-', {
            itemId: 'synch',
            text: 'Synchronization',
            iconCls: 'icon-synch',
            action: 'synch-persone'
        }]
    }];

    // paging bar on the bottom
    this.bbar = Ext.create('Ext.PagingToolbar', {
        store: this.store,
        displayInfo: true,
        displayMsg: 'Displaying topics {0} - {1} of {2}',
        emptyMsg: "No topics to display",
        items:[]
    });

    this._initColumns();
    this._initFilter();
    this.callParent(arguments);
},
于 2012-02-28T12:25:02.107 に答える