Search code examples
javascriptextjsextjs4javascript-framework

Get Grid Cell Value on Hover in ExtJS4


I have the following code in a grid:

    var grid = Ext.create('Ext.grid.Panel', {
        store: store,
        stateful: true,
        stateId: 'stateGrid',
        columns: [
            {
                text     : 'Job ID',
                width : 75,
                sortable : true,
                dataIndex: 'id'
            },
            {
                text     : 'File Name',
                width    : 75,
                sortable : true,
                dataIndex: 'filename', 
                listeners : {
                    'mouseover' : function(iView, iCellEl, 
                                  iColIdx, iRecord, iRowEl, iRowIdx, iEvent) {
                       var zRec = iView.getRecord(iRowEl);
                       alert(zRec.data.id);
                    }
                }

...etc...

I can't figure out how to get the cell value of the first column in the row. I've also tried:

        var record = grid.getStore().getAt(iRowIdx); // Get the Record
        alert(iView.getRecord().get('id'));

Any ideas?

Thanks in advance!


Solution

  • It's easier than what you have.

    Look at the Company column config here for an example- http://jsfiddle.net/qr2BJ/4580/

    Edit:

    Part of grid definition code:

    ....
    columns: [
        {
            text     : 'Company',
            flex     : 1,
            sortable : false,
            dataIndex: 'company',
            renderer : function (value, metaData, record, row, col, store, gridView) {
                metaData.tdAttr = 'data-qtip="' + record.get('price') + ' is the price of ' + value + '"';
                return value;
            }
        },
        ....