我正在创建一个数据类型为local的JQgrid,我想使用getLocalRow或getCell从编辑行中获取行值,但我总是得到false。 这是我网格的定义:jqGrid getLocalRow返回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);
}
});
的onSelectRow功能是:
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');
但在这两种情况下,我总是错误的。
任何解决方案?
对不起,但它不是解决方案。如果我使用: var localRowData = $(“#rowed5”)。jqGrid('getLocalRow',1); 我得到了同样的结果:false – Rafael
@Rafael:这意味着'1'不是来自jqGrid的id。你应该把代码放在清楚的地方**你在哪里使用'getLocalRow'。此外,一些简单的测试数据('mydata')的帖子也可能有帮助。直到现在您发布了长代码,但它不包含任何'getLocalRow'调用,这是您的主要问题。 – Oleg