我需要以兩種格式顯示日期,如mm/dd/yyyy和mm/dd/yyyy hh:mm:ss。我發現,我們可以在colmodeljqgrid日期排序和格式化
formatoptions: {srcformat: 'ISO8601Long', newformat: 'm/d/y'}
和
formatoptions: {srcformat: 'ISO8601Long', newformat: 'm/d/y h:i:s'}
使用formatoptions但我在jqGrid的爲MM/DD/YY獲得輸出。任何一個解決方案如何顯示mm/dd/yyyy。我需要對兩列進行排序。
在此先感謝
thanx oleg,但排序不會發生。我的colmodel代碼是'{name:'invdate',index:'invdate',sorttype:'date',formatter:'date',formatoptions:{srcformat:'ISO8601Long',newformat:'m/d/Y'}} ,'我的數組數據是'{id:「1」,invdate:「2007-10-01」,name:「test」}'。我錯過任何屬性嗎? – Sabarish
@ user669789:現在我明白了您的主要問題,並建議您使用srcformat:'Y-m-d H:i:s''而不是srcformat:'ISO8601Long''作爲解決方法。我更新了我的答案。 – Oleg
thanx其工作。 – Sabarish