CheckBox, action event

Razairo Aluguera picture Razairo Aluguera · Jul 9, 2012 · Viewed 9.9k times · Source

I need to add a Check box, and when the user checks on it (as in changes the value check/uncheck) to print a console.log statement. So far i was able to display the check box, but unable to access its check event.

{
    xtype: 'checkboxgroup',
    columns: 1,

    listeners: {
        change: function (this, newValue, oldValue, eOpts) {
            console.log('change');
            console.log(newValue);
        }
    },
    items: [{
        boxLabel: 'Cars',
        name: 'chk1',
        inputValue: '1'
    }]
}

Answer

CD.. picture CD.. · Jul 9, 2012

As for any other field, the change event should work.

Example: http://jsfiddle.net/mbbjz/2/