Mukta Chourishi
Mukta Chourishi

Reputation: 51

How to get other column value on selecting a checkbox on a tree grid

I have a tree grid and there are two columns Duration and a checkbox column. What i want is when i select / deselect checkbox I should get Duration column value. This is the code i have tried But dont know as how do I access the Duration value.

{
    xtype: 'nacheckcolumn', //only display checkbox on leaf items(tasks)
    header: 'N/A',
    dataIndex: 'NA',
    menuDisabled: true,
    width: 60,
    sortable: false,
    editor: {
        xtype: 'checkbox',
        cls: 'x-grid-checkheader-editor'
    },
    listeners: {
        'checkchange': function (column, recordIndex, checked) {
            console.log(checked);                              
            if(checked === true) {
            }
        }
    }                                
}

Upvotes: 0

Views: 375

Answers (1)

Lorenz Meyer
Lorenz Meyer

Reputation: 19915

Get the record from the recordIndex :

var record = column.up('grid').getStore().getAt(recordIndex) 

Then get the value of the desired column :

var duration = record.get('duration') 

Together :

'checkchange': function (column, recordIndex, checked) { 
    console.log(checked);
    if(checked === true) {
        var record = column.up('grid').getStore().getAt(recordIndex), 
        duration = record.get('duration') 
    }
} 

Upvotes: 1

Related Questions