编辑控制器未在jqGrid中接收任何数据 [英] Edit Controller is not receiving any data in jqGrid
本文介绍了编辑控制器未在jqGrid中接收任何数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< script type = text / javascript> ;
$( document )。ready( function (){
$(< span class =code-string> #tblJQGrid)。jqGrid(
{
url: Default / GetDataForEmployeeJQGrid',
datatype: json,
reloadAfterSubmit: true ,
contentType: application / json; charset-utf-8,
mtype:' GET',
colNames:[' TaskId',' EmployeeId',' 名称'],
colModel:[
{name: ' TaskId',index:' TaskId ',width: 50 ,stype:' text'},
{name:' EmployeeId',index: ' EmployeeId',width: 20 , stype:' text',可编辑: true ,editoptions:{dataEvents:[{type:' focusout',fn: function (e){$(' #HiddenNet')。val( this .value); },} editrules:{custom: false ,}},
{name:' 名称',索引:' 名称',width: 150 ,可编辑: true ,editoptions:{dataEvents:[{type:' focusout',fn: function (e){ $(' #HiddenNet')。val( this .value); },} editrules:{custom: true ,}}],
editurl: / Default / GridEdit,
pager:jQuery(' #listpager'),
rowNum: 10 ,
rowList:[ 5 , 10 , 20 , 50 ],
sortname:' Id',
sortorder : desc,
viewrecords: true ,
标题: 列出员工详细信息
}) ;
jQuery( #tblJQGrid)。jqGrid( ' navGrid',' #listpager',{
edit: true ,
add: true ,
del: true ,
search: true ,
刷新: true ,
},
{ // 编辑记录表格
url: / Default / GridEdit /,closeAfterEdit: true ,beforeShowForm: function (formid){$( #Id,formid).hide( ); }
},
{ // 新记录表格
closeAfterAdd : true ,
recreateForm: true ,
viewPagerButtons: false
},
{ // 删除记录表格
recreateForm: true
});
$( #tblJQGrid)。setGridWidth( Math .round($( window )。width() - 100, true ));
$(' 。ui-pg-button')。on( 点击, function (ev){
ClickEventId = 此 .id;
});
});
< / script>
解决方案
( document ).ready( function (){
( #tblJQGrid)。jqGrid(
{
url:' < span class =code-string> Default / GetDataForEmployeeJQGrid',
datatype: json ,
reloadAfterSubmit: true ,
contentType: < span class =code-string> application / json; charset-utf-8,
mtype:' GET',
colNames:[' TaskId' ,' EmployeeId',' 名称'],
colModel:[
{name:' TaskId ',index:' TaskId',width: 50 ,stype:' text'},
{name: ' EmployeeId',index:' < span class =code-string> EmployeeId',width: 20 ,stype:' text',可编辑: true ,editoptions:{dataEvents:[{type:' focusout',fn: function (e){
(' #HiddenNet ')。val( this .value); },} editrules:{custom: false ,}},
{name:' 名称',索引:' 名称',width: 150 ,可编辑: true ,editoptions:{dataEvents:[{type:' focusout',fn: function (e){
<script type="text/javascript">
$(document).ready(function () {
$("#tblJQGrid").jqGrid(
{
url: 'Default/GetDataForEmployeeJQGrid',
datatype: "json",
reloadAfterSubmit: true,
contentType: "application/json; charset-utf-8",
mtype: 'GET',
colNames: ['TaskId', 'EmployeeId', 'Name'],
colModel: [
{ name: 'TaskId', index: 'TaskId', width: 50, stype: 'text' },
{ name: 'EmployeeId', index: 'EmployeeId', width: 20, stype: 'text', editable: true, editoptions: { dataEvents: [{ type: 'focusout', fn: function (e) { $('#HiddenNet').val(this.value); } }] }, editrules: { custom: false, } },
{ name: 'Name', index: 'Name', width: 150, editable: true, editoptions: { dataEvents: [{ type: 'focusout', fn: function (e) { $('#HiddenNet').val(this.value); } }] }, editrules: { custom: true, } }],
editurl: "/Default/GridEdit",
pager: jQuery('#listpager'),
rowNum: 10,
rowList: [5, 10, 20, 50],
sortname: 'Id',
sortorder: "desc",
viewrecords: true,
caption: "List Employee Details"
});
jQuery("#tblJQGrid").jqGrid('navGrid', '#listpager', {
edit: true,
add: true,
del: true,
search: true,
refresh: true,
},
{ //edit record form
url: "/Default/GridEdit/", closeAfterEdit: true, beforeShowForm: function (formid) { $("#Id",formid).hide(); }
},
{ //new record form
closeAfterAdd: true,
recreateForm: true,
viewPagerButtons: false
},
{ //delete record form
recreateForm: true
});
$("#tblJQGrid").setGridWidth(Math.round($(window).width()-100, true));
$('.ui-pg-button').on('click', function (ev) {
ClickEventId = this.id;
});
});
</script>
解决方案
(document).ready(function () {
("#tblJQGrid").jqGrid( { url: 'Default/GetDataForEmployeeJQGrid', datatype: "json", reloadAfterSubmit: true, contentType: "application/json; charset-utf-8", mtype: 'GET', colNames: ['TaskId', 'EmployeeId', 'Name'], colModel: [ { name: 'TaskId', index: 'TaskId', width: 50, stype: 'text' }, { name: 'EmployeeId', index: 'EmployeeId', width: 20, stype: 'text', editable: true, editoptions: { dataEvents: [{ type: 'focusout', fn: function (e) {
('#HiddenNet').val(this.value); } }] }, editrules: { custom: false, } }, { name: 'Name', index: 'Name', width: 150, editable: true, editoptions: { dataEvents: [{ type: 'focusout', fn: function (e) {
这篇关于编辑控制器未在jqGrid中接收任何数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文