Jquery JQgrid-访问inlineNav返回数据

Jquery JQgrid-访问inlineNav返回数据,jquery,jquery-plugins,jqgrid,inline-editing,Jquery,Jquery Plugins,Jqgrid,Inline Editing,就在昨天,我才开始使用jq网格,到目前为止,事情的处理方式对我来说有些模糊。见下文 function setUpStudentEntryGrid(numberofstuds){ $("#studentset").jqGrid({ url:"<c:url value='/registrationcarts/constructjson/'/>"+numberofstuds, datatype: "json",

就在昨天,我才开始使用jq网格,到目前为止,事情的处理方式对我来说有些模糊。见下文

    function setUpStudentEntryGrid(numberofstuds){
        $("#studentset").jqGrid({
            url:"<c:url value='/registrationcarts/constructjson/'/>"+numberofstuds, 
            datatype: "json",
            colNames:['id','First Name', 'Last Name'], 
            colModel:[ 
                       {name:'id',index:'id', width:60}, 
                       {name:'firstName',index:'fName', width:300, editable:true},
                       {name:'lastName',index:'lastName', width:300, editable:true}
                     ],                  
            rowNum:10, 
            rowList:[10,20,30], 
            pager: '#pager',
            sortname: 'id', 
            viewrecords: true, 
            sortorder: "desc",
            editurl: "<c:url value='/students/addnew'/>", 
            caption: "Using navigator"
        });
        $('#studentset').jqGrid('navGrid',"#pager",{edit:false,add:false,save:false,del:false,search:false});
        $('#studentset').jqGrid('inlineNav',"#pager");
    }
功能设置StudentEntryGrid(螺柱数){
$(“#学生集”).jqGrid({
url:“+numberofstuds,
数据类型:“json”,
colNames:['id','First Name','Last Name'],
colModel:[
{名称:'id',索引:'id',宽度:60},
{name:'firstName',index:'fName',宽度:300,可编辑:true},
{name:'lastName',索引:'lastName',宽度:300,可编辑:true}
],                  
rowNum:10,
行列表:[10,20,30],
寻呼机:“#寻呼机”,
sortname:'id',
viewrecords:是的,
巫师:“描述”,
editurl:“”,
标题:“使用导航器”
});
$('#studentset').jqGrid('navGrid',“#pager”,{edit:false,add:false,save:false,del:false,search:false});
$('studentset').jqGrid('inlineNav',“#pager”);
}
我有内联编辑工作,数据将进入数据库。我的操作只是返回一个字符串,上面写着“student saved”。在fire bug上,我正在响应中获取我的返回字符串,以便我的操作能够正常工作。我计划使用
$('#studentset').jqGrid('setRowData',新创建的\u ID,{firstName:'name',lastName:'name})修改我的字符串后

如上图所示,如何使用InlineAV手动访问和更新行ID

可以说,我是在捞救命稻草,因为我不太确定如何设置它。有人能给我建议吗


谢谢。

好的,所以我只需要调用data.tosource,就可以看到数据对象中包含的所有内容。我感兴趣的关键是responseText,因此

            onSelectRow: function(id){ 
                if((id != null)&&(id!==lastsel)){ 
                    $('#studentset').jqGrid('restoreRow',lastsel); 
                    $('#studentset').jqGrid('editRow',id,true,'',function(data){
                        alert(data.responseText);

                    });                         
                    lastsel=id; 
                } 
            }

希望这能帮助有需要的人

您缺少一个大括号:
editurl:
}
})
您需要2个花括号:1)关闭
onsetrow
功能。2) 关闭
jqGrid
options对象。这里是适当的缩进:只有在添加新行的情况下(编辑现有行没有问题),才使用
inlineav
?在您的案例中,新创建的ID是什么?是否要从服务器返回新id(从数据库生成)并在网格中使用它?是“new_created_id”是刚刚添加的记录的id。拥有所有的值,我也可以返回一个包含这些值的字符串。问题实际上是基于参数从服务器返回的字符串中存在访问权限。类似于函数(数据){alert(数据);}