Получить значение ячейки сетки при наведении в ExtJS4 - PullRequest
2 голосов
/ 18 ноября 2011

У меня есть следующий код в сетке:

    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);
                    }
                }

... и т.д. ...

Я не могу понять, как получить значение ячейки первого столбцав ряд.Я также попробовал:

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

Есть идеи?

Заранее спасибо!

Ответы [ 2 ]

6 голосов
/ 18 ноября 2011

Это проще, чем у вас.

Посмотрите здесь конфигурацию столбца Компания для примера - http://jsfiddle.net/qr2BJ/4580/

Редактировать:

Часть кода определения сетки:

....
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;
        }
    },
    ....
0 голосов
/ 09 февраля 2013

Вы можете добавить обработчик вместо слушателя.

{
    header: 'DETAILS',
    xtype:'actioncolumn', 
    align:'center', 
    width: 70, 
    sortable: false, 
    items: [
        {
            icon: '/icons/details_icon.png',  // Use a URL in the icon config
            tooltip: 'Show Details',    
            handler: function(grid, rowIndex, colIndex) {
                var record = grid.getStore().getAt(rowIndex);
            }
...