Clay Banks
Clay Banks

Reputation: 4581

Selecting specific cells in a grid - Ext JS

I have set up a controller here that listens for a click on a grid row:

   init: function() {
            this.control({
                'mygrid': {
                    select: this.viewDesc //On click...
                }
            });
        },

Right now this event fires no matter what cell is clicked on. However, I want to listen for the click of a specific column/cells.

How could this be achieved?

Upvotes: 1

Views: 1578

Answers (1)

Nandkumar Tekale
Nandkumar Tekale

Reputation: 16158

You can use cellclick event for grid, and identify on which cell user has clicked, it would be something like :

init: function() {
    this.control({
        'mygrid': {
            cellclick: function(view, td, cellIndex, record, tr, rowIndex, e, eOpts) {
                // if clicked on cell 4, show popup otherwise ignore
                if(cellIndex == 3) { // cellIndex starts from 0
                    Ext.Msg.alert('Selected Record', 'Name : ' + record.get('firstname') + ' ' + record.get('lastname'));
                }
            }
        }
    });
},

Above code snippet is taken from my answer to your previous question

Upvotes: 1

Related Questions