0

グリッドがあり、このグリッドのtbarにあるいくつかのボタンを(コントローラーから)制御したい場合。

itemIdプロパティを持つボタンを見つけることができますが、クラスごとにボタンを見つける方法と、どのクラスを使用する必要がありますか(baseCls、clsなどがあり、それらは機能しません)?

これが私のコントローラーコードです:

Ext.define("Wtb.controller.Schedule",{
extend:'Ext.app.Controller',

    refs:[{
        ref:'grid',
        selector:'button'
    }],
init: function () {

    this.control({
        'button#remove':{
            click:this.Remove
        },
        'button#refresh':{
            click: this.Load
        },
        'button#save':{ //Buttons with id works fine
            click:this.Save
        },
        'button.period':{ //It can't be found, because here is the class
            click:this.changePeriod
        }
    })

そしてここにボタンスニペットがあります:

{ //Button with ID
    xtype:"button",
    itemId:'refresh',
    text:"Refresh"
},'->',{ //Button with class. I need some buttons, like this.
    xtype:"button",
    text:"Period - day",
    cls:'period',
    value:'day'
}

コントローラからクラスごとにボタンを見つける方法は?

4

1 に答える 1

4

ComponentQueryのドキュメントを確認してください:http://docs.sencha.com/ext-js/4-0/#! / api / Ext.ComponentQuery

これにより、正しいボタンが表示されます。

'button[cls=period]'
于 2012-04-04T23:22:02.320 に答える