jqGrid的,ASP.NET,JSON是快把我逼疯了。请帮忙 [英] jqGrid, ASP.NET, JSON is Driving me crazy. Please Help
问题描述
我一直试图让这几天在天工作,它似乎是一个又一个的事情。起初,我终于跟踪它到ASP.NET传递日期的JSON字符串回电网麻烦。我现在用JSON.NET和日期都回来了,他们应该是我坚持的右后卫,我alwasy似乎是这样。这里是我的code,返回JSON字符串,并jqGrid的code也(我很抱歉这是这么长时间,但我只是不想留下任何东西了的情况下,这是被拧我的一部分向上)!基本上,我不断地停留在Ajax调用,我试着addJSONData的成功方法....截至目前我正在从Firebug的一个错误,指出:
属性ID无效
({共1页:1,记录:5,[{ROWID:1,...... RNAME:密件抄送,SubmitterID:BCC4010,苏
任何帮助将SO大大AP preCIATED!我想在这么多使用这个插件,但我将绝对坚果试图使它的工作!
在此先感谢,Briana: - )
的WebMethod:
&所述;的WebMethod()> _
< Script.Services.ScriptMethod(UseHttpGet:=假,ResponseFormat:= ResponseFormat.Json)GT; _
公共职能GetTableData()作为字符串
昏暗objController作为新TradingPartnersController
昏暗gv_page作为字符串=的String.Empty
昏暗SIDX作为字符串=的String.Empty
DIM SORD作为字符串=的String.Empty
昏暗开始为String =的String.Empty
昏暗的上限为String =的String.Empty
昏暗的行作为字符串=的String.Empty
昏暗的标题为String =的String.Empty
昏暗的计数为整数= 0
昏暗TOTAL_PAGES为整数= 0 gv_page = HttpContext.Current.Request.Form(页)'.FORM(页)
得到被请求的页面
限制= HttpContext.Current.Request.Form(行)
得到我们想要多少行有到网
SIDX = HttpContext.Current.Request.Form(SIDX)
获得索引行 - 即用户点击排序
SORD = HttpContext.Current.Request.Form(SORD)
拿到方向
如果String.IsNullOrEmpty(SIDX)然后
SIDX =PARTNERID 万一 如果String.IsNullOrEmpty(SORD)然后
SORD =ASC 万一 如果String.IsNullOrEmpty(极限)然后
极限= 10 万一 ''连接到数据库
GridView1.DataSource = objController.ListAll()
GridView1.DataBind() 昏暗objCollection方式列表(中TradingPartnersInfo)= objController.ListAll()
数= objCollection.Count 如果count> 0,则
TOTAL_PAGES = Math.Ceiling(计数/ Int32.Parse(限制))
其他
TOTAL_PAGES = 0
万一 如果gv_page是Nothing然后
gv_page = 1
万一
如果没有gv_page> TOTAL_PAGES然后
gv_page = TOTAL_PAGES
万一 开始= Math.Ceiling(Int32.Parse(限制)*(Int32.Parse(gv_page) - Int32.Parse(限制)))
如果start< 1然后启动= 1
昏暗objPageCollection方式列表(中TradingPartnersInfo)= objController.ListTradingPartners(SIDX,SORD,Int32.Parse(开始),Int32.Parse(限制))
昏暗的JSON作为新的StringBuilder
json.Append({)
json.Append(总:&放大器; total_pages.ToString&安培;,)
json.Append(页:与& gv_page.ToString&放大器;,)
json.Append(记载:&放大器; count.ToString&安培;,)
json.Append(JsonConvert.SerializeObject(objPageCollection))
json.Append(})
返回json.ToString 结束功能
这里是jqGrid的code:
jQuery的('table.scroll')。的jqGrid({
jsonReader:{
根:行,//哈利包含实际数据
页:页面,//当前页面
总:总,//在查询总页数
记录:记录,//记录总数
repeatitems:假的,
ID:ID//使用PK它索引中列
},
数据类型:功能(POSTDATA){
jQuery.jmsajax({
键入:POST,
网址:EDI.asmx
方法:GetTableData
数据类型:msjson
数据:{},
完成:功能(数据){
变种mygrid = jQuery的('table.scroll')[0];
变种结果=(EVAL((+ data.responseText +)));
变种myjsongrid =(jeval(result.d));
警报(myjsongrid.rows);
mygrid.addJSONData(jeval(myjsongrid.rows)); //这是错误行 myjsongrid = NULL;
myjsongridParsed = NULL;
结果= NULL;
},
成功:功能(数据){
警报('成功:'+数据);
},
错误:功能(XHR){
VAR解析度= xhr.responseText;
警报(RES);
}
});
},
colNames:
ROWID
ID,
PARTNERID
方向,
InterchangeVersion
InterchangeSenderID
InterchangeReceiverID
ProductionMode
SubmitterName
SubmitterID
SubmitterPOC
CommQual
CommNumber
ReceiverName
ReceiverID
PartnerType
PartnerNotes
IncomingSP
OutgoingSP
ExchangeAck
请将isDeleted
DateTimeInserted
的KeyID
] colModel:
{名:ROWID
宽度:1,
隐藏:真实,
键:假的,
sorttype:'诠释',
editrules:{searchhidden:假的,
hidedlg:真实,
索引:ROWID,
jsonmap:ROWID
}
}, {名:ID,
宽度:1,
隐藏:真实,
键:真实,
sorttype:'诠释',
editrules:{searchhidden:真实,
hidedlg:假的,
指数:'ID',
jsonmap:ID
}
}, {名:PARTNERID
宽度:50,
可调整大小:真实,
排序:真实,
sorttype:'文字',
编辑:真的,
edittype:'文字',
editrules:{要求:真实,
索引:PARTNERID',
jsonmap:PARTNERID',
标签:'PARTNERID',
可调整大小:真实,
搜索:真
}
},
{名:方向,
宽度:50,
可调整大小:真实,
排序:真实,
sorttype:'文字',
编辑:真的,
edittype:'选择',
editoptions:{值:我:O},
editrules:{要求:真实,
指数:'方向',
jsonmap:'方向',
标签:'方向',
可调整大小:真实,
搜索:真
}
}, {名:InterchangeVersion
宽度:50,
可调整大小:真实,
排序:真实,
sorttype:'文字',
编辑:真的,
edittype:'选择',
editoptions:{值:004010X098A1:004010X097A1:004010X096A1:004010X098A:004010X097A:004010X096A},
editrules:{要求:真实,
索引:InterchangeVersion',
jsonmap:InterchangeVersion',
标签:'InterchangeVersion',
可调整大小:真,搜索:真
}
}, {名:InterchangeSenderID
宽度:50,
可调整大小:真实,
排序:真实,
sorttype:'文字',
编辑:真的,
edittype:'文字',
editrules:{要求:真实,
索引:InterchangeSenderID',
jsonmap:InterchangeSenderID',
标签:'InterchangeSenderID',
可调整大小:真实,
搜索:真
}
}, {名:InterchangeReceiverID
宽度:50,
可调整大小:真实,
排序:真实,
sorttype:'文字',
编辑:真的,
edittype:'文字',
editrules:{要求:真实,
索引:InterchangeReceiverID',
jsonmap:InterchangeReceiverID',
标签:'InterchangeReceiverID',
可调整大小:真实,
搜索:真
}
}, {名:ProductionMode
宽度:50,
可调整大小:真实,
排序:真实,
sorttype:'文字',
编辑:真的,
edittype:'选择',
editoptions:{值:T:P},
editrules:{要求:真实,
索引:ProductionMode',
jsonmap:ProductionMode',
标签:'ProductionMode',
可调整大小:真实,
搜索:真
}
}, {名:SubmitterName
宽度:50,
可调整大小:真实,
排序:真实,
sorttype:'文字',
编辑:真的,
edittype:'文字',
editrules:{要求:真实,
索引:SubmitterName',
jsonmap:SubmitterName',
标签:'SubmitterName',
可调整大小:真实,
搜索:真
}
}, {名:SubmitterID
宽度:50,
可调整大小:真实,
排序:真实,
sorttype:'文字',
编辑:真的,
edittype:'文字',
editrules:{要求:真实,
索引:SubmitterID',
jsonmap:SubmitterID',
标签:'SubmitterID',
可调整大小:真实,
搜索:真
}
}, {名:SubmitterPOC
宽度:50,
可调整大小:真实,
排序:真实,
sorttype:'文字',
编辑:真的,
edittype:'文字',
editrules:{要求:真实,
索引:SubmitterPOC',
jsonmap:SubmitterPOC',
标签:'SubmitterPOC',
可调整大小:真实,
搜索:真
}
}, {名:CommQual
宽度:50,
可调整大小:真实,
排序:真实,
sorttype:'文字',
编辑:真的,
edittype:选择,
editoptions:{值:ED:EM:FX:TE},
editrules:{要求:假的,
索引:CommQual',
jsonmap:CommQual',
标签:'CommQual',
可调整大小:真实,
搜索:真
}
}, {名:CommNumber
宽度:50,
可调整大小:真实,
排序:真实,
sorttype:'文字',
编辑:真的,
edittype:'文字',
editrules:{要求:假的,
索引:CommNumber',
jsonmap:CommNumber',
标签:'CommNumber',
可调整大小:真实,
搜索:真
}
}, {名:ReceiverName
宽度:50,
可调整大小:真实,
排序:真实,
sorttype:'文字',
编辑:真的,
edittype:'文字',
editrules:{要求:真实,
索引:ReceiverName',
jsonmap:ReceiverName',
标签:'ReceiverName',
可调整大小:真实,
搜索:真
}
}, {名:ReceiverID
宽度:50,
可调整大小:真实,
排序:真实,
sorttype:'文字',
编辑:真的,
edittype:'文字',
editrules:{要求:真实,
索引:ReceiverID',
jsonmap:ReceiverID',
标签:'ReceiverID',
可调整大小:真实,
搜索:真
}
}, {名:PartnerType
宽度:50,
可调整大小:真实,
排序:真实,
sorttype:'文字',
编辑:真的,
edittype:选择,
editoptions:{值:信息中心:PPO:两者},
editrules:{要求:真实,
索引:PartnerType',
jsonmap:PartnerType',
标签:'PartnerType',
可调整大小:真实,
搜索:真
}
}, {名:PartnerNotes
宽度:50,
可调整大小:真实,
排序:真实,
sorttype:'文字',
编辑:真的,
edittype:'textarea的,
editrules:{要求:假的,
索引:PartnerNotes',
jsonmap:PartnerNotes',
标签:'PartnerNotes',
可调整大小:真实,
搜索:真
}
}, {名:IncomingData prePSP
宽度:50,
可调整大小:真实,
排序:真实,
sorttype:'文字',
编辑:真的,
edittype:'文字',
editrules:{要求:假的,
索引:IncomingData prePSP,
jsonmap:IncomingData prePSP,
标签:'IncomingData prePSP,
可调整大小:真实,
搜索:真
}
}, {名:OutgoingData prePSP
宽度:50,
可调整大小:真实,
排序:真实,
sorttype:'文字',
编辑:真的,
edittype:'文字',
editrules:{要求:假的,
索引:OugoingData prePSP,
jsonmap:OugoingData prePSP,
标签:'OutgoingData prePSP,
可调整大小:真实,
搜索:真
}
}, {名:ExchangeAck
宽度:50,
可调整大小:真实,
排序:真实,
sorttype:'文字',
编辑:真的,
edittype:选择,
editoptions:{值:真:假},
editrules:{要求:真实,
索引:ExchangeAck',
jsonmap:ExchangeAck',
标签:'ExchangeAck',
可调整大小:真实,
搜索:真
}
}, {名:请将isDeleted
宽度:5,
可调整大小:假的,
排序:真实,
sorttype:'文字',
编辑:真的,
edittype:选择,
editoptions:{值:是:否},
editrules:{要求:真实,
索引:请将isDeleted,
jsonmap:msg.d.isDeleted',
标签:请将isDeleted,
可调整大小:真实,
搜索:真
}
}, {名:DateTimeInserted
宽度:20,
隐藏:假的,
datefmt:Y-M-D',
sorttype:日期,
编辑:假的,
editrules:{指数:'DateTimeInserted',
jsonmap:DateTimeInserted',
标签:'DateTimeInserted',
可调整大小:真实,
搜索:真
}
}, {名的KeyID
宽度:5,
隐藏:真实,
键:假的,
sorttype:'诠释',
editrules:{指数:'的KeyID',
jsonmap:'的KeyID',
hidedlg:真实,
标签:'的KeyID',
可调整大小:假的,
搜索:假的
}
}
]
高度:400,
shrinkToFit:真实,
寻呼机:jQuery的('#寻呼机),
的rowNum:10,
rowList:[10,20,30,40,50],
sortname:ROWID,
排序顺序:ASC
viewrecords:真实,
imgpath:HTTP://localhost/DNN5/js/jQuery/jqGrid-3.4.3/themes/sand/images',
标题:X12贸易伙伴的,
viewrecords:真实,
gridComplete:功能(){
警报(我完成电网+ JSON.stringify(MSG));
//更新新列的顺序位置
$('table.scroll')tableDnDUpdate()。
}})navGrid('table.scroll',{编辑:真,地址:真实,德尔:。真})tableDnD();
下面是返回JSON字符串:(我有没有问题,看到这个数据返回给客户端。)
成功:
<$p$p><$c$c>{total:1,page:1,records:5,[{\"ROWID\":1,\"ID\":1,\"PartnerID\":\"BCN\",\"Direction\":\"I\",\"InterchangeVersion\":\"004010X096A1\",\"InterchangeSenderID\":\"BCC4010\",\"InterchangeReceiverID\":\"company\",\"ProductionMode\":\"T\",\"SubmitterName\":\"BCC\",\"SubmitterID\":\"BCC4010\",\"SubmitterPOC\":\"BCC\",\"CommQual\":\"\",\"CommNumber\":\"\",\"ReceiverName\":\"company\",\"ReceiverID\":\"BCC4010\",\"PartnerTypes\":\"\",\"PartnerNotes\":\"\",\"IncomingData$p$ppSP\":\"\",\"OutgoingData$p$ppSP\":\"\",\"ExchangeAck\":false,\"DateTimeInserted\":new Date(1214412777787),\"IsDeleted\":false},{\"ROWID\":2,\"ID\":2,\"PartnerID\":\"BCN\",\"Direction\":\"I\",\"InterchangeVersion\":\"004010X098A1\",\"InterchangeSenderID\":\"BCC4010\",\"InterchangeReceiverID\":\"company\",\"ProductionMode\":\"T\",\"SubmitterName\":\"BCC\",\"SubmitterID\":\"BCC4010\",\"SubmitterPOC\":\"BCC\",\"CommQual\":\"\",\"CommNumber\":\"\",\"ReceiverName\":\"company\",\"ReceiverID\":\"BCC4010\",\"PartnerTypes\":\"\",\"PartnerNotes\":\"\",\"IncomingData$p$ppSP\":\"\",\"OutgoingData$p$ppSP\":\"\",\"ExchangeAck\":false,\"DateTimeInserted\":new Date(1212088125000),\"IsDeleted\":false},{\"ROWID\":3,\"ID\":3,\"PartnerID\":\"BCN\",\"Direction\":\"O\",\"InterchangeVersion\":\"004010X091A1\",\"InterchangeSenderID\":\"HCA770385729\",\"InterchangeReceiverID\":\"BCC47198 ,ProductionMode:T,SubmitterName:公司Administrators\",\"SubmitterID\":\"HCA770385729\",\"SubmitterPOC\":\"briana\",\"CommQual\":\"EM\",\"CommNumber\":\"briana@company.com\",\"ReceiverName\":\"BCN\",\"ReceiverID\":\"BCC47198\",\"PartnerTypes\":\"\",\"PartnerNotes\":\"\",\"IncomingData$p$ppSP\":\"\",\"OutgoingData$p$ppSP\":\"\",\"ExchangeAck\":false,\"DateTimeInserted\":new Date(1212088125547),\"IsDeleted\":false},{\"ROWID\":4,\"ID\":4,\"PartnerID\":\"EHG\",\"Direction\":\"I\",\"InterchangeVersion\":\"004010X097A1\",\"InterchangeSenderID\":\"330989922\",\"InterchangeReceiverID\":\"company\",\"ProductionMode\":\"T\",\"SubmitterName\":\"DENTALCONNECT\",\"SubmitterID\":\"330989922\",\"SubmitterPOC\":\"\",\"CommQual\":\"\",\"CommNumber\":\"\",\"ReceiverName\":\"\",\"ReceiverID\":\"\",\"PartnerTypes\":\"Clearinghouse\",\"PartnerNotes\":\"Dental票据交换所。在发送帐单地址付费分割(NM1 * 87)和服务地址在计费环节(NM1*85).\",\"IncomingData$p$ppSP\":\"[dispatch].sp$p$pprocessEHG\",\"OutgoingData$p$ppSP\":\"\",\"ExchangeAck\":true,\"DateTimeInserted\":new Date(1235603192033),\"IsDeleted\":false},{\"ROWID\":5,\"ID\":5,\"PartnerID\":\"EMDEON\",\"Direction\":\"I\",\"InterchangeVersion\":\"004010X097A1\",\"InterchangeSenderID\":\"341884003\",\"InterchangeReceiverID\":\"857297703\",\"ProductionMode\":\"T\",\"SubmitterName\":\"INTERACTIVE PAYER NETWORK\",\"SubmitterID\":\"341884003\",\"SubmitterPOC\":\"\",\"CommQual\":\"\",\"CommNumber\":\"\",\"ReceiverName\":\"\",\"ReceiverID\":\"\",\"PartnerTypes\":\"Clearinghouse\",\"PartnerNotes\":\"Dental票据交换所。在发送帐单地址付费分割(NM1 * 87)和服务地址在计费环节(NM1*85).\",\"IncomingData$p$ppSP\":\"\",\"OutgoingData$p$ppSP\":\"\",\"ExchangeAck\":true,\"DateTimeInserted\":new日期(1235603192000),请将isDeleted:假}]}其实, tvanfosson 的使用行标识的要求一个很好的点。我不熟悉的 jMSAjax 的,所以我的意见可能是无效的。我很高兴能意识到这一点。
难道是作为返回类型为字符串一样简单的东西吗?也就是说,当反应进行评估时,你最终封装的字符串不是JSON对象。
我已经在类似的地方我自己。我发现的选项是要么,创建一个业务对象重新presents预期的jqGrid响应并返回而不是对象的字符串(ASP.NET将序列化作为JSON为您服务!)或修改的jqGrid到的 EVAL 的响应两次(乱)。
I've been trying to get this to work for days upon days and it seems like one thing after another. Initially, I finally tracked it down to trouble passing ASP.NET dates in the JSON string back to the grid. I am now using JSON.NET and the dates are coming back the way they should be I'm stuck right back where I alwasy seem to be. Here is my code, returned json string, and jqGrid code also: (I'm sorry it's so long, but I just didn't want to leave anything out in case that was the part that was screwing me up)! Basically, I am continually stuck in the success method of the ajax call where I try to addJSONData.... as of right now I am getting an error from Firebug that says: invalid property id ({total:1,page:1,records:5,[{"ROWID":1,"...rName":"BCC","SubmitterID":"BCC4010","Su
ANY HELP WOULD BE SO GREATLY APPRECIATED! I Want to use this plug in so much, but I am going absolutely nuts trying to make it work!
Thanks in Advance, Briana :-)
WebMethod:
<WebMethod()> _
<Script.Services.ScriptMethod(UseHttpGet:=False, ResponseFormat:=ResponseFormat.Json)> _
Public Function GetTableData() As String
Dim objController As New TradingPartnersController
Dim gv_page As String = String.Empty
Dim sidx As String = String.Empty
Dim sord As String = String.Empty
Dim start As String = String.Empty
Dim limit As String = String.Empty
Dim row As String = String.Empty
Dim header As String = String.Empty
Dim count As Integer = 0
Dim total_pages As Integer = 0
gv_page = HttpContext.Current.Request.Form("page") '.Form("page")
' get the requested page
limit = HttpContext.Current.Request.Form("rows")
' get how many rows we want to have into the grid
sidx = HttpContext.Current.Request.Form("sidx")
' get index row - i.e. user click to sort
sord = HttpContext.Current.Request.Form("sord")
' get the direction
If String.IsNullOrEmpty(sidx) Then
sidx = "PartnerID"
End If
If String.IsNullOrEmpty(sord) Then
sord = "ASC"
End If
If String.IsNullOrEmpty(limit) Then
limit = 10
End If
'' connect to the database
'GridView1.DataSource = objController.ListAll()
'GridView1.DataBind()
Dim objCollection As List(Of TradingPartnersInfo) = objController.ListAll()
count = objCollection.Count
If count > 0 Then
total_pages = Math.Ceiling(count / Int32.Parse(limit))
Else
total_pages = 0
End If
If gv_page Is Nothing Then
gv_page = 1
End If
If Not gv_page > total_pages Then
gv_page = total_pages
End If
start = Math.Ceiling(Int32.Parse(limit) * (Int32.Parse(gv_page) - Int32.Parse(limit)))
If start < 1 Then start = 1
Dim objPageCollection As List(Of TradingPartnersInfo) = objController.ListTradingPartners(sidx, sord, Int32.Parse(start), Int32.Parse(limit))
Dim json As New StringBuilder
json.Append("{")
json.Append("total:" & total_pages.ToString & ",")
json.Append("page:" & gv_page.ToString & ",")
json.Append("records:" & count.ToString & ",")
json.Append(JsonConvert.SerializeObject(objPageCollection))
json.Append("}")
Return json.ToString
End Function
Here is the jqGrid code:
jQuery('table.scroll').jqGrid({
jsonReader: {
root: "rows", //arry containing actual data
page: "page", //current page
total: "total", //total pages for the query
records: "records", //total number of records
repeatitems: false,
id: "ID" //index of the column with the PK in it
},
datatype: function(postdata) {
jQuery.jmsajax({
type: "POST",
url: "EDI.asmx",
method: "GetTableData",
dataType: "msjson",
data: {},
complete: function(data) {
var mygrid = jQuery('table.scroll')[0];
var result = (eval("(" + data.responseText + ")"));
var myjsongrid = (jeval(result.d));
alert(myjsongrid.rows);
mygrid.addJSONData(jeval(myjsongrid.rows)); //This is ERROR LINE
myjsongrid = null;
myjsongridParsed = null;
result = null;
},
success: function(data) {
alert('success: ' + data);
},
error: function(xhr) {
var res = xhr.responseText;
alert(res);
}
});
},
colNames: [
"ROWID",
"ID",
"PartnerID",
"Direction",
"InterchangeVersion",
"InterchangeSenderID",
"InterchangeReceiverID",
"ProductionMode",
"SubmitterName",
"SubmitterID",
"SubmitterPOC",
"CommQual",
"CommNumber",
"ReceiverName",
"ReceiverID",
"PartnerType",
"PartnerNotes",
"IncomingSP",
"OutgoingSP",
"ExchangeAck",
"isDeleted",
"DateTimeInserted",
"KeyID"
],
colModel: [
{ name: "ROWID",
width: 1,
hidden: true,
key: false,
sorttype: 'int',
editrules: { searchhidden: false,
hidedlg: true,
index: 'ROWID',
jsonmap: 'ROWID'
}
},
{ name: "ID",
width: 1,
hidden: true,
key: true,
sorttype: 'int',
editrules: { searchhidden: true,
hidedlg: false,
index: 'ID',
jsonmap: 'ID'
}
},
{ name: "PartnerID",
width: 50,
resizable: true,
sortable: true,
sorttype: 'text',
editable: true,
edittype: 'text',
editrules: { required: true,
index: 'PartnerID',
jsonmap: 'PartnerID',
label: 'PartnerID',
resizable: true,
search: true
}
},
{ name: "Direction",
width: 50,
resizable: true,
sortable: true,
sorttype: 'text',
editable: true,
edittype: 'select',
editoptions: { value: "I:O" },
editrules: { required: true,
index: 'Direction',
jsonmap: 'Direction',
label: 'Direction',
resizable: true,
search: true
}
},
{ name: "InterchangeVersion",
width: 50,
resizable: true,
sortable: true,
sorttype: 'text',
editable: true,
edittype: 'select',
editoptions: { value: "004010X098A1:004010X097A1:004010X096A1:004010X098A:004010X097A:004010X096A" },
editrules: { required: true,
index: 'InterchangeVersion',
jsonmap: 'InterchangeVersion',
label: 'InterchangeVersion',
resizable: true, search: true
}
},
{ name: "InterchangeSenderID",
width: 50,
resizable: true,
sortable: true,
sorttype: 'text',
editable: true,
edittype: 'text',
editrules: { required: true,
index: 'InterchangeSenderID',
jsonmap: 'InterchangeSenderID',
label: 'InterchangeSenderID',
resizable: true,
search: true
}
},
{ name: "InterchangeReceiverID",
width: 50,
resizable: true,
sortable: true,
sorttype: 'text',
editable: true,
edittype: 'text',
editrules: { required: true,
index: 'InterchangeReceiverID',
jsonmap: 'InterchangeReceiverID',
label: 'InterchangeReceiverID',
resizable: true,
search: true
}
},
{ name: "ProductionMode",
width: 50,
resizable: true,
sortable: true,
sorttype: 'text',
editable: true,
edittype: 'select',
editoptions: { value: "T:P" },
editrules: { required: true,
index: 'ProductionMode',
jsonmap: 'ProductionMode',
label: 'ProductionMode',
resizable: true,
search: true
}
},
{ name: "SubmitterName",
width: 50,
resizable: true,
sortable: true,
sorttype: 'text',
editable: true,
edittype: 'text',
editrules: { required: true,
index: 'SubmitterName',
jsonmap: 'SubmitterName',
label: 'SubmitterName',
resizable: true,
search: true
}
},
{ name: "SubmitterID",
width: 50,
resizable: true,
sortable: true,
sorttype: 'text',
editable: true,
edittype: 'text',
editrules: { required: true,
index: 'SubmitterID',
jsonmap: 'SubmitterID',
label: 'SubmitterID',
resizable: true,
search: true
}
},
{ name: "SubmitterPOC",
width: 50,
resizable: true,
sortable: true,
sorttype: 'text',
editable: true,
edittype: 'text',
editrules: { required: true,
index: 'SubmitterPOC',
jsonmap: 'SubmitterPOC',
label: 'SubmitterPOC',
resizable: true,
search: true
}
},
{ name: "CommQual",
width: 50,
resizable: true,
sortable: true,
sorttype: 'text',
editable: true,
edittype: "select",
editoptions: { value: "ED:EM:FX:TE" },
editrules: { required: false,
index: 'CommQual',
jsonmap: 'CommQual',
label: 'CommQual',
resizable: true,
search: true
}
},
{ name: "CommNumber",
width: 50,
resizable: true,
sortable: true,
sorttype: 'text',
editable: true,
edittype: 'text',
editrules: { required: false,
index: 'CommNumber',
jsonmap: 'CommNumber',
label: 'CommNumber',
resizable: true,
search: true
}
},
{ name: "ReceiverName",
width: 50,
resizable: true,
sortable: true,
sorttype: 'text',
editable: true,
edittype: 'text',
editrules: { required: true,
index: 'ReceiverName',
jsonmap: 'ReceiverName',
label: 'ReceiverName',
resizable: true,
search: true
}
},
{ name: "ReceiverID",
width: 50,
resizable: true,
sortable: true,
sorttype: 'text',
editable: true,
edittype: 'text',
editrules: { required: true,
index: 'ReceiverID',
jsonmap: 'ReceiverID',
label: 'ReceiverID',
resizable: true,
search: true
}
},
{ name: "PartnerType",
width: 50,
resizable: true,
sortable: true,
sorttype: 'text',
editable: true,
edittype: "select",
editoptions: { value: "Clearinghouse:PPO:Both" },
editrules: { required: true,
index: 'PartnerType',
jsonmap: 'PartnerType',
label: 'PartnerType',
resizable: true,
search: true
}
},
{ name: "PartnerNotes",
width: 50,
resizable: true,
sortable: true,
sorttype: 'text',
editable: true,
edittype: 'textarea',
editrules: { required: false,
index: 'PartnerNotes',
jsonmap: 'PartnerNotes',
label: 'PartnerNotes',
resizable: true,
search: true
}
},
{ name: "IncomingDataPrepSP",
width: 50,
resizable: true,
sortable: true,
sorttype: 'text',
editable: true,
edittype: 'text',
editrules: { required: false,
index: 'IncomingDataPrepSP',
jsonmap: 'IncomingDataPrepSP',
label: 'IncomingDataPrepSP',
resizable: true,
search: true
}
},
{ name: "OutgoingDataPrepSP",
width: 50,
resizable: true,
sortable: true,
sorttype: 'text',
editable: true,
edittype: 'text',
editrules: { required: false,
index: 'OugoingDataPrepSP',
jsonmap: 'OugoingDataPrepSP',
label: 'OutgoingDataPrepSP',
resizable: true,
search: true
}
},
{ name: "ExchangeAck",
width: 50,
resizable: true,
sortable: true,
sorttype: 'text',
editable: true,
edittype: "select",
editoptions: { value: "True:False" },
editrules: { required: true,
index: 'ExchangeAck',
jsonmap: 'ExchangeAck',
label: 'ExchangeAck',
resizable: true,
search: true
}
},
{ name: "isDeleted",
width: 5,
resizable: false,
sortable: true,
sorttype: 'text',
editable: true,
edittype: "select",
editoptions: { value: "Yes:No" },
editrules: { required: true,
index: 'isDeleted',
jsonmap: 'msg.d.isDeleted',
label: 'isDeleted',
resizable: true,
search: true
}
},
{ name: "DateTimeInserted",
width: 20,
hidden: false,
datefmt: 'Y-m-d',
sorttype: 'date',
editable: false,
editrules: { index: 'DateTimeInserted',
jsonmap: 'DateTimeInserted',
label: 'DateTimeInserted',
resizable: true,
search: true
}
},
{ name: "KeyID",
width: 5,
hidden: true,
key: false,
sorttype: 'int',
editrules: { index: 'KeyID',
jsonmap: 'KeyID',
hidedlg: true,
label: 'KeyID',
resizable: false,
search: false
}
}
],
height: 400,
shrinkToFit: true,
pager: jQuery('#pager'),
rowNum: 10,
rowList: [10, 20, 30, 40, 50],
sortname: 'ROWID',
sortorder: "asc",
viewrecords: true,
imgpath: 'http://localhost/DNN5/js/jQuery/jqGrid-3.4.3/themes/sand/images',
caption: 'X12 Trading Partners',
viewrecords: true,
gridComplete: function() {
alert("i'm grid complete" + JSON.stringify(msg));
//updates the new column order position
$('table.scroll').tableDnDUpdate();
}}).navGrid('table.scroll', { edit: true, add: true, del: true }).tableDnD();
Here is the Returned JSON String: (I have no problem seeing this data being returned to client.)
success:
{total:1,page:1,records:5,[{"ROWID":1,"ID":1,"PartnerID":"BCN","Direction":"I","InterchangeVersion":"004010X096A1","InterchangeSenderID":"BCC4010","InterchangeReceiverID":"company","ProductionMode":"T","SubmitterName":"BCC","SubmitterID":"BCC4010","SubmitterPOC":"BCC","CommQual":"","CommNumber":"","ReceiverName":"company","ReceiverID":"BCC4010","PartnerTypes":"","PartnerNotes":"","IncomingDataPrepSP":"","OutgoingDataPrepSP":"","ExchangeAck":false,"DateTimeInserted":new Date(1214412777787),"IsDeleted":false},{"ROWID":2,"ID":2,"PartnerID":"BCN","Direction":"I","InterchangeVersion":"004010X098A1","InterchangeSenderID":"BCC4010","InterchangeReceiverID":"company","ProductionMode":"T","SubmitterName":"BCC","SubmitterID":"BCC4010","SubmitterPOC":"BCC","CommQual":"","CommNumber":"","ReceiverName":"company","ReceiverID":"BCC4010","PartnerTypes":"","PartnerNotes":"","IncomingDataPrepSP":"","OutgoingDataPrepSP":"","ExchangeAck":false,"DateTimeInserted":new Date(1212088125000),"IsDeleted":false},{"ROWID":3,"ID":3,"PartnerID":"BCN","Direction":"O","InterchangeVersion":"004010X091A1","InterchangeSenderID":"HCA770385729","InterchangeReceiverID":"BCC47198 ","ProductionMode":"T","SubmitterName":"company Administrators","SubmitterID":"HCA770385729","SubmitterPOC":"briana","CommQual":"EM","CommNumber":"briana@company.com","ReceiverName":"BCN","ReceiverID":"BCC47198","PartnerTypes":"","PartnerNotes":"","IncomingDataPrepSP":"","OutgoingDataPrepSP":"","ExchangeAck":false,"DateTimeInserted":new Date(1212088125547),"IsDeleted":false},{"ROWID":4,"ID":4,"PartnerID":"EHG","Direction":"I","InterchangeVersion":"004010X097A1","InterchangeSenderID":"330989922","InterchangeReceiverID":"company","ProductionMode":"T","SubmitterName":"DENTALCONNECT","SubmitterID":"330989922","SubmitterPOC":"","CommQual":"","CommNumber":"","ReceiverName":"","ReceiverID":"","PartnerTypes":"Clearinghouse","PartnerNotes":"Dental clearinghouse. Sends billing address in the pay-to segment (NM1*87) and the service address in the billing segment (NM1*85).","IncomingDataPrepSP":"[dispatch].spPreprocessEHG","OutgoingDataPrepSP":"","ExchangeAck":true,"DateTimeInserted":new Date(1235603192033),"IsDeleted":false},{"ROWID":5,"ID":5,"PartnerID":"EMDEON","Direction":"I","InterchangeVersion":"004010X097A1","InterchangeSenderID":"341884003","InterchangeReceiverID":"857297703","ProductionMode":"T","SubmitterName":"INTERACTIVE PAYER NETWORK","SubmitterID":"341884003","SubmitterPOC":"","CommQual":"","CommNumber":"","ReceiverName":"","ReceiverID":"","PartnerTypes":"Clearinghouse","PartnerNotes":"Dental clearinghouse. Sends billing address in the pay-to segment (NM1*87) and the service address in the billing segment (NM1*85).","IncomingDataPrepSP":"","OutgoingDataPrepSP":"","ExchangeAck":true,"DateTimeInserted":new Date(1235603192000),"IsDeleted":false}]}
Actually, tvanfosson makes an excellent point with the requirement of the 'rows' identifier. I'm unfamiliar with jMSAjax so my comments may be null and void. I'm glad to be aware of it.
Could it be something as simple as the return type being string? That is, when the response is evaluated, you end up with the encapsulated string not the json object.
I've been in a similar place myself. I found the options to be either, create a business object that represents the expected jqGrid response and return the object not a string (ASP.NET will serialize it as JSON for you!) or modify the jqGrid to eval the response twice (messy).
这篇关于jqGrid的,ASP.NET,JSON是快把我逼疯了。请帮忙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!