我不确定这是与jqgrid相关还是web服务/回发/ JSON问题,但我会尽量提供尽可能多的信息。jqgrid表单发布到webservice日期时间更改格式
我发布jqgrid的模式弹出与DateTime字段。
当帖子来自其提交下列资料(如在Firebug看到的)浏览器的后退:
InStock Yes
Name Desktop Computer
Note note
Ship 4
ShipDate 05-11-2013
id 1
oper edit
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string UpdateOrder(DateTime ShipDate, string Name, Stock InStock,Ship Ship, string Note,int id)
{
return "";
}
的jqGrid的colModel样子..
colModel:[
{name:'Id',index:'Id', width:60, sorttype:"int", editable: false},
{name:'ShipDate',index:'ShipDate',width:90, editable:true, sorttype:"date",unformat: pickDate},
{name:'Name',index:'Name', width:150,editable: true,editoptions:{size:"20",maxlength:"30"}},
{name:'InStock',index:'InStock', width:70, editable: true,edittype:"checkbox",editoptions: {value:"Yes:No"},unformat: aceSwitch},
{name:'Ship',index:'Ship', width:90, editable: true,edittype:"select",editoptions:{value:"4:FedEx;1:InTime;2:TNT;3:ARAMEX"}},
{name:'Note',index:'Note', width:150, sortable:false,editable: true,edittype:"textarea", editoptions:{rows:"2",cols:"10"}}
],
和pickDate样子
function pickDate(cellvalue, options, cell) {
setTimeout(function(){
$(cell) .find('input[type=text]')
.datepicker({format:'dd-mm-yyyy' , autoclose:true});
}, 0);
}
另外编辑形式风格如下(当编辑形式显示出来)
function style_edit_form(form) {
//enable datepicker on "sdate" field and switches for "stock" field
form.find('input[name=ShipDate]').datepicker({format:'dd-mm-yyyy' , autoclose:true})
.end().find('input[name=stock]')
.addClass('ace ace-switch ace-switch-5').wrap('<label class="inline" />').after('<span class="lbl"></span>');
然而,当数据是在服务器(ASMX服务)接收的日期时间(并按ShipDate)变化为“2013年11月5日00:00:00”,而从客户端发送的SHIPDATE是05 -11-2013(这是正确的)。任何想法发生了什么?
而你的问题是? – Mark
对此表示道歉,问题以粗体突出显示。 – daehaai