我不確定這是與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