Asp.net mvc 4 我的查询是在mvc中的jqgrid列上显示格式化程序showlink,当我单击它时,它会打开另一个jqgrid
这是我的jqgrid结构,我的问题是,当我点击格式化程序时,我的数据将显示为这样,而不是另一个jqgridAsp.net mvc 4 我的查询是在mvc中的jqgrid列上显示格式化程序showlink,当我单击它时,它会打开另一个jqgrid,asp.net-mvc-4,jqgrid-formatter,Asp.net Mvc 4,Jqgrid Formatter,这是我的jqgrid结构,我的问题是,当我点击格式化程序时,我的数据将显示为这样,而不是另一个jqgrid {"total":1,"page":1,"records":1,"rows":[{"MobileID":12,"MobileName":"Lumia-730","MobileIMEno":"123456987","MobileManufactured":"Nokia","Mobileprice":15000}]} $(function () { $("#grid")
{"total":1,"page":1,"records":1,"rows":[{"MobileID":12,"MobileName":"Lumia-730","MobileIMEno":"123456987","MobileManufactured":"Nokia","Mobileprice":15000}]}
$(function () {
$("#grid").jqGrid({
url: "/Jqgrid/GetGridLists",
datatype: 'json',
mtype: 'Get',
colNames: ['MobileID', 'MobileName', 'MobileIMEno', 'MobileManufactured', 'Mobileprice'],
colModel: [
{ key: true, hidden: true, name: 'MobileID', index: 'MobileID', editable: true, search: true },
{ key: true, name: 'MobileName', index: 'MobileName', editable: true, search: true, stype: "text", formatter: formateadorLink },
{ key: true, name: 'MobileIMEno', index: 'MobileIMEno', editable: true, search: true, stype: "text" },
{ key: true, name: 'MobileManufactured', index: 'MobileManufactured', editable: true, search: true, stype: "text" },
{ key: true, name: 'Mobileprice', index: 'Mobileprice', editable: true, search: true, stype: "text" }
],
pager: jQuery('#pager'),
rowNum: 10,
rowList: [10, 20, 30, 40],
height: '100%',
viewrecords: true,
caption: 'Mobile List',
emptyrecords: 'No records to display',
jsonReader: {
root: "rows",
page: "page",
total: "total",
records: "records",
repeatitems: false,
Id: "0"
},
autowidth: true,
multiselect: false,
subGrid: true,
subGridRowExpanded: function (subgrid_id, row_id) {
var subgrid_table_id, pager_id;
subgrid_table_id = subgrid_id + '_t';
pager_id = "p_" + subgrid_table_id;
$('#' + subgrid_id).html('<table id="' + subgrid_table_id + '" class="scroll"></table><div id="' + pager_id + '" class="scroll"></div>');
$('#' + subgrid_table_id).jqGrid({
url: '/Jqgrid/GetGridLists?id=' + row_id,
datatype: 'json',
mtype: 'POST',
colNames: ['MobileID', 'MobileName', 'MobileIMEno', 'MobileManufactured', 'Mobileprice'],
colModel: [
{ key: true, hidden: true, name: 'MobileID', index: 'MobileID', editable: true, search: true },
{ key: true, name: 'MobileName', index: 'MobileName', editable: true, search: true, stype: "text" },
{ key: true, name: 'MobileIMEno', index: 'MobileIMEno', editable: true, search: true, stype: "text" },
{ key: true, name: 'MobileManufactured', index: 'MobileManufactured', editable: true, search: true, stype: "text" },
{ key: true, name: 'Mobileprice', index: 'Mobileprice', editable: true, search: true, stype: "text" }
],
rowNum: 10,
rowList: [10, 20, 30, 40],
pager: pager_id,
sortname: 'Bank',
sortorder: 'asc',
viewrecords: true,
height: '100%',
jsonReader: {
root: "rows",
page: "page",
total: "total",
records: "records",
repeatitems: false,
Id: "0"
},
autowidth: true,
multiselect: false
});
$('#' + subgrid_table_id).jqGrid('navGrid', '#' + pager_id, { edit: false, add: false, del: false })
}
}).navGrid('#pager', { edit: true, add: true, del: true, search: true, refresh: true },
{
// edit options
zIndex: 100,
url: '/Jqgrid/Edit',
closeOnEscape: true,
closeAfterEdit: true,
recreateForm: true,
afterComplete: function (response) {
if (response.responseText) {
alert(response.responseText);
}
}
},
{
// add options
zIndex: 100,
url: "/Jqgrid/Create",
closeOnEscape: true,
closeAfterAdd: true,
afterComplete: function (response) {
if (response.responseText) {
alert(response.responseText);
}
}
},
{
// delete options
zIndex: 100,
url: "/Jqgrid/Delete",
closeOnEscape: true,
closeAfterDelete: true,
recreateForm: true,
msg: "Are you sure you want to delete this task?",
afterComplete: function (response) {
if (response.responseText) {
alert(response.responseText);
}
}
},
{
// Search options
zIndex: 100,
searchOnEnter: true,
//url: "/Jqgrid/Search",
closeOnEscape: true,
closeAfterSearch: true,
afterComplete: function (response) {
if (response.responseText) {
alert(response.responseText);
}
}
});
jQuery('#grid').jqGrid('navButtonAdd', '#pager', {
caption: "EXCEL", title: 'Export to EXCEL', onClickButton: function (e) {
try {
jQuery("#grid").jqGrid('excelExport', { tag: "Excel", url: '/Jqgrid/ExportToExcel' });
} catch (e) {
}
}
});
jQuery('#grid').jqGrid('navButtonAdd', '#pager', {
caption: "PDF", title: 'Export to PDF', onClickButton: function (e) {
try {
jQuery("#grid").jqGrid('excelExport', { tag: "PDF", url: 'Jqgrid/NewExportToPdf' });
} catch (e) {
}
}
});
});
function formateadorLink(cellvalue, options, rowObject) {
return "<a href=/LinkGrid/GetGridLists/?value=" + cellvalue + ">" + cellvalue + "</a>";
}
{“总计”:1,“页面”:1,“记录”:1,“行”:[{“MobileID”:12,“MobileName”:“Lumia-730”,“MobileIMEno”:“123456987”,“MobileManufactured”:“诺基亚”,“Mobileprice”:15000}}
$(函数(){
$(“#网格”).jqGrid({
url:“/Jqgrid/GetGridLists”,
数据类型:“json”,
mtype:'获取',
ColName:['MobileID'、'MobileName'、'MobileMeno'、'MobileManufactured'、'Mobileprice'],
colModel:[
{key:true,hidden:true,name:'MobileID',index:'MobileID',editable:true,search:true},
{key:true,name:'MobileName',index:'MobileName',editable:true,search:true,stype:'text',formatter:formatteadorlink},
{key:true,name:'MobileIMEno',index:'MobileIMEno',editable:true,search:true,stype:'text},
{key:true,name:'MobileManufactured',index:'MobileManufactured',editable:true,search:true,stype:'text},
{key:true,name:'Mobileprice',index:'Mobileprice',可编辑:true,search:true,stype:'text}
],
pager:jQuery(“#pager”),
rowNum:10,
行列表:[10,20,30,40],
高度:“100%”,
viewrecords:是的,
标题:“移动列表”,
emptyrecords:'没有要显示的记录',
jsonReader:{
根:“行”,
第页:“第页”,
总计:“总计”,
记录:“记录”,
重复项:false,
Id:“0”
},
自动宽度:正确,
多选:错,
子网格:对,
subGridRowExpanded:函数(subgrid\u id,row\u id){
var子网格表id、寻呼机id;
子网格_表_id=子网格_id+'_t';
pager_id=“p_”+子网格\u表\u id;
$(“#”+子网格id).html(“”);
$(“#”+子网格_表_id).jqGrid({
url:'/Jqgrid/GetGridLists?id='+row_id,
数据类型:“json”,
mtype:“POST”,
ColName:['MobileID'、'MobileName'、'MobileMeno'、'MobileManufactured'、'Mobileprice'],
colModel:[
{key:true,hidden:true,name:'MobileID',index:'MobileID',editable:true,search:true},
{key:true,name:'MobileName',index:'MobileName',可编辑:true,search:true,stype:'text},
{key:true,name:'MobileIMEno',index:'MobileIMEno',editable:true,search:true,stype:'text},
{key:true,name:'MobileManufactured',index:'MobileManufactured',editable:true,search:true,stype:'text},
{key:true,name:'Mobileprice',index:'Mobileprice',可编辑:true,search:true,stype:'text}
],
rowNum:10,
行列表:[10,20,30,40],
寻呼机:寻呼机id,
sortname:'银行',
排序器:“asc”,
viewrecords:是的,
高度:“100%”,
jsonReader:{
根:“行”,
第页:“第页”,
总计:“总计”,
记录:“记录”,
重复项:false,
Id:“0”
},
自动宽度:正确,
多重选择:错误
});
$(“#”+子网格_表_id).jqGrid('navGrid',“#”+寻呼机_id,{edit:false,add:false,del:false})
}
}).navGrid(“#pager”,{edit:true,add:true,del:true,search:true,refresh:true},
{
//编辑选项
zIndex:100,
url:“/Jqgrid/Edit”,
closeOnEscape:没错,
closeAfterEdit:true,
再现形式:正确,
完成后:功能(响应){
if(response.responseText){
警报(response.responseText);
}
}
},
{
//添加选项
zIndex:100,
url:“/Jqgrid/Create”,
closeOnEscape:没错,
closeAfterAdd:true,
完成后:功能(响应){
if(response.responseText){
警报(response.responseText);
}
}
},
{
//删除选项
zIndex:100,
url:“/Jqgrid/Delete”,
closeOnEscape:没错,
closeAfterDelete:true,
再现形式:正确,
msg:“您确定要删除此任务吗?”,
完成后:功能(响应){
if(response.responseText){
警报(response.responseText);
}
}
},
{
//搜索选项
zIndex:100,
是的,
//url:“/Jqgrid/Search”,
closeOnEscape:没错,
closeAfterSearch:没错,
完成后:功能(响应){
if(response.responseText){
警报(response.responseText);
}
}
});
jQuery(“#grid”).jqGrid('navButtonAdd','#pager'{
标题:“EXCEL”,标题:“导出到EXCEL”,单击按钮:函数(e){
试一试{
jQuery(“#grid”).jqGrid('excelExport',{tag:'Excel',url:'/jqGrid/ExportToExcel'});
}捕获(e){
}
}
});
jQuery(“#grid”).jqGrid('navButtonAdd','#pager'{
标题:“PDF”,标题:“导出为PDF”,单击按钮:函数(e){
试一试{
jqGrid('excelExport',{tag:'PDF',url:'jqGrid/NewExportToPdf'});
}捕获(e){
}
}