作为“目标” handler工具栏按钮,控制器的方法?

发布于 2025-01-07 18:38:38 字数 954 浏览 3 评论 0原文

你好!

我希望这个处理程序“handler:onEventControler(???)”从视图中删除(它不属于那里)

对于网格视图设置dockedItems这个cod:

        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,但我无法要求按钮选择器查询。

我如何正确尊重 mvc extJs4 架构?

谢谢。

Hello!

I want this handler "handler: onEventControler (???)" removed from view (it do not belong there)

For grid view set dockedItems this cod:

        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);
                }
            }
        }]
    }]

I also tried to implement a this.control, but I could not ask for a button selectorQuery.

How do I properly respecting the architecture mvc extJs4?

thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

两相知 2025-01-14 18:38:38

您应该能够在此视图的控制器内执行类似的操作。

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

You should be able to do something like this inside the controller of this view.

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

Handler:

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

Alternatively, you could use an "action" config on your button.

action: 'addstation'

Then you could have:

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

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

萌梦深 2025-01-14 18:38:38

这是视图 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);
},

This is method "initComponent" for view gridd view:

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);
},
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文