{header:'操作', dataIndex:'oper',renderer:function(value, metaData, record, rowIndex, colIndex, store){
return "<input type='button'  onclick='testbutton()' value='查看详细信息'>";
总么调用testbutton方法,要得到gridPanel,不能再Ext.onReady()写方法体.

解决方案 »

  1.   

    testbutton()是ExtJs框架里面自己写的,你无视它,替换成你的就可以了。相当于javascript:void(0);
      

  2.   

    testbutton()是我写的,我是想每一行有一个按钮,然后点击这个按钮触发一个onclick事件,调用我指定的方法。
      

  3.   

    你这样写的没什么问题啊,你要是想得到gridPanel,可以直接在testButton中写就是了。{header:'操作', dataIndex:'oper',renderer:function(value, metaData, record, rowIndex, colIndex, store){
    return "<input type='button' onclick='testbutton('+rowIndex+')' value='查看详细信息'>";function testButton(index){
       listGrid.getStore().getAt(index).data.id.......就可以得到这一行的属性}
      

  4.   

    你现在能触发 testButton方法不?可以的话 将grid定义为全局的 getCmp不就行了
      

  5.   

    直接调用testbutton不行啊,会报缺少对象
    我这样写就可以的:
     function testbutton(id){
      alert(id);
      }
    textfunction=function (colIndex,rowIndex)
    {
        var id=grid.getStore().getAt(rowIndex).data.id;
        testbutton(id);
    }
    textfunction是我定义的一个全局变量,这样为什么就可以呢?
      

  6.   

    直接传递renderer的参数到自定义的testbutton方法。
      

  7.   

    直接传递renderer的参数到自定义的testbutton方法。参数是可以传递的,主要是我希望能在gridPanel里面直接调用testbutton这个方法.可不能直接调用.