2012-07-06 59 views
0

我試圖用json數據在mvc項目中使用jqwidget網格。用於日期字段的網格單元格格式是問題。下面的代碼獲取像「/ Date(1340204039263)/」的單元格。我該如何解決這個問題?jqwidget json數據的網格單元格格式

$(document).ready(function() { 
// prepare the data 
var source = { 
    datatype: "json", 
    datafields: [{ name: 'PersonelId' }, { name: 'Ad' }, { name: 'DogumYili' }, { name: 'UyelikTarihi'}], 
    url: 'BindBasicGrid' 
}; 

//var dataAdapter = new $.jqx.dataAdapter(source); 
var dataAdapter = new $.jqx.dataAdapter(source, { 
    downloadComplete: function (data, status, xhr) { alert(JSON.stringify(data)); }, 
    loadComplete: function (data) { }, 
    loadError: function (xhr, status, error) { alert(JSON.stringify(xhr)); } 
}); 

$("#jqxgrid").jqxGrid({ 
    source: dataAdapter, 
    theme: 'classic', 
    columns: [{ text: 'Ad', datafield: 'Ad', width: 250 }, 
       { text: 'Doğum Yılı', datafield: 'DogumYili', width: 150 }, 
       { text: 'Üyelik Tarihi', datafield: 'UyelikTarihi', cellsformat: 'D', width: 180}] 
}); 

});

回答

0

您是否在初始化過程中嘗試過使用{name:'UyelikTarihi',類型:'date'}而不是{name:'UyelikTarihi'}?

+0

它的工作,謝謝。 – serefbilge 2012-07-07 16:47:36