jqGrid getLocalRow返回false

jqGrid getLocalRow返回false,jqgrid,Jqgrid,我正在创建一个数据类型为local的JQgrid,我想通过使用getLocalRow或getCell编辑行来获取行值,但我总是得到false。 这是我的网格定义: jQuery("#rowed5").jqGrid({ datatype: 'local', data: mydata, loadtext:"Cargando...", height: altura*0.4, width: anchoDefecto*0.9, colNames:['C

我正在创建一个数据类型为local的JQgrid,我想通过使用getLocalRow或getCell编辑行来获取行值,但我总是得到false。 这是我的网格定义:

jQuery("#rowed5").jqGrid({  
    datatype: 'local',
    data: mydata,

    loadtext:"Cargando...",
    height: altura*0.4,
    width: anchoDefecto*0.9,
    colNames:['Cuenta',
              'Subcuenta',
              'Importe',
              'Signo',
              'Clave',
              'Documento',
              'Doc. Referencia',
              'Ampliación',
              'Extensión'],
    colModel:[
            {name:'intIdfCuenta',index:'intIdfCuenta', width:200, sorttype:"int", editable:true,editrules:{required:true}, edittype:'custom', 
                editoptions:{custom_element: myelemcuentas, custom_value:myvaluecuentas} },
            {name:'intIdfSubcuenta',index:'intIdfSubcuenta', width:200,editable: true,editrules:{required:true}, edittype:'custom', 
                    editoptions:{custom_element: myelemsubcuentas, custom_value:myvaluesubcuentas}},
            {name:'floatImporte',index:'floatImporte', width:200,editable: true,editrules:{required:true}, edittype:'text'},
            {name:'strSigno',index:'strSigno', width:200,editable: true, edittype:'custom',editrules:{required:true}, 
                editoptions:{custom_element: myelemsigno, custom_value:myvaluesigno} },
            {name:'strIdfClave',index:'strIdfClave', width:200,editable: true,editrules:{required:true}, edittype:'custom', 
                    editoptions:{custom_element: myelemclave, custom_value:myvalueclave} },
            {name:'strDocumento',index:'strDocumento', width:200,editable: true,editrules:{required:true},edittype:'text'},
            {name:'strDocumentoReferencia',index:'strDocumentoReferencia', width:200,editable: true,edittype:'text'},
            {name:'strAmpliacion',index:'strAmpliacion', width:200,editable: true,edittype:'text',editoptions: {
            dataInit: function (elem) { $(elem).focus(function () { this.select(); }) },
            dataEvents: [
                {
                    type: 'keydown',
                    fn: function (e) {
                        var key = e.charCode || e.keyCode;
                        if (key == 9)
                        {
                           procesarTabulacionAmpliacion();
                        }
                    }
                }
            ]
            }
            },
            {name:'strIdfTipoExtension',index:'strIdfTipoExtension', width:200,editable:true,edittype:'custom', 
                editoptions:{custom_element: myelemextension, custom_value:myvalueextension} }
            ],
    cellsubmit: "clientArray",  
    pager:"#pager",
    onSelectRow: function(id){          
        selectNextRow(id);

    }
});
OnSetrow功能是:

function selectNextRow(id){     
     if (lastsel!=null && id!==lastsel && !myRowIsValid(lastsel) ) {
         if(lastsel!=null && id!==lastsel){
             jQuery('#rowed5').jqGrid('setSelection', lastsel);
         }
         return false;
     }else if(id && id!==lastsel){      
         newline = '0';         
        jQuery("#rowed5").saveRow(lastsel, false, 'clientArray');
        jQuery("#rowed5").editRow(id, false);

        lastsel=id;
        actsel = id;
        // ponemos foco
        $(getId("intIdfCuenta",actsel,true)).focus();
    }
}
我尝试使用以下方式获取行信息:

            var floatImporte = $("#rowed5").jqGrid('getCell', 'floatImporte');
            var localRowData = $("#rowed5").jqGrid('getLocalRow');
但在这两种情况下,我总是会出错


任何解决方案?

方法
getLocalRow
有一个参数:
rowid
。因此,
getLocalRow
的正确用法是

var localRowData=$(“#rowed5”).jqGrid('getLocalRow',id);

如果不使用参数调用
getLocalRow
,则
getLocalRow
会将
rowid
视为
undefined
,并且无法返回相应行的数据。如果
getLocalRow
返回
false

,我也遇到了同样的问题,只是创建了一个。您可以通过单击行来更改某些值。问题是“getLocalRow”总是返回false,因为找不到rowid。我稍微研究了一下代码,在jquery.jqGrid.src.js中有一行:

ind = this.p._index[stripPref(this.p.idPrefix, rowid)];
它用rowid=“a_jqg2”调用,例如,这里的.p.idPrefix是“a_qg2”

我用错了吗


丹尼斯

对不起,这不是解决办法。如果我使用:var localRowData=$(“#rowed5”).jqGrid('getLocalRow',1);我得到了同样的结果:false@Rafael:这意味着
1
不是来自jqGrid的id。您应该将代码张贴在您使用
getLocalRow
的明确位置(在哪个上下文中)。另外,发布一些简单的测试数据(
mydata
)也会有帮助。到目前为止,您发布了很长的代码,但它不包含任何对
getLocalRow
的调用,这是您的主要问题。