在gridpanel中,怎么在已知行、列的情况下取得该单元格的信息,求大神指教

解决方案 »

  1.   

    比如你单击,获得点击的单元格的数值。我帮不上你的忙,但是我觉得是不是再grid载入的时候,就应该有一个listeners啊,有了这个,才能获得吧。给你看看官方文档,listeners
    A config object containing one or more event handlers to be added to this object during initialization. This should be a valid listeners config object as specified in the addListener example for attaching multiple handlers at once.DOM events from Ext JS ComponentsWhile some Ext JS Component classes export selected DOM events (e.g. "click", "mouseover" etc), this is usually only done when extra value can be added. For example the DataView's itemclick event passing the node clicked on. To access DOM events directly from a child element of a Component, we need to specify the element option to identify the Component property to add a DOM listener to:
    new Ext.panel.Panel({
        width: 400,
        height: 200,
        dockedItems: [{
            xtype: 'toolbar'
        }],
        listeners: {
            click: {
                element: 'el', //bind to the underlying el property on the panel
                fn: function(){ console.log('click el'); }
            },
            dblclick: {
                element: 'body', //bind to the underlying body property on the panel
                fn: function(){ console.log('dblclick body'); }
            }
        }
    });
      

  2.   


                    listeners:{
                     cellclick: function(table, td, cellIndex, model, tr, rowIndex, e, eOpts){
    //单击单元格事件
                     }
                    }
      

  3.   

    监听单击事件确实能得到该单元格,但是我想的是通过行号和列号来得到(其实就是得到当前选中的单元格信息,文档里好像没有响应的函数,只能得到一行的信息),另外官方文档里怎么没有cellclick事件的定义,找不到
      

  4.   


    添加单击监听可以得到,但如果直接取就不知道怎么取了,extjs怎么封装之后连table基本的功能都实现不了。
      

  5.   


    grid.getSelectionModel().getSelection()[0].get('fieldname');
    //把grid和'fieldname'换成你的自己定义的名称
      

  6.   

    var projCd = Ext.getCmp('costGrid').getStore().getAt(rowIndex).get('projCd');