Telerikの剣道グリッドを使用して問題が発生しています。私は、日付フィルタを使用してデータサーバー側をフィルタリングしたい。 剣道グリッドの日付フィルターがJSONデータで動作しない
<div id="grid"></div>
<script>
$(document).ready(function() {
$("#grid").kendoGrid({
dataSource: {
type: "odata",
transport: {
read: "http://demos.telerik.com/kendo-ui/service/Northwind.svc/Orders"
},
schema: {
model: {
fields: {
OrderDate: { type: "date" }
}
}
},
pageSize: 20,
serverPaging: true,
serverFiltering: true,
serverSorting: true
},
height: 550,
filterable: true,
sortable: true,
pageable: true,
columns: [
{
field: "OrderDate",
title: "Order Date",
format: "{0:MMM dd, yyyy}",
parseFormats: "{0:MM/dd/yyyy}",
headerTemplate: '<label for="check-all"><b>Start Date</b></label>',
headerAttributes: { style: "text-align: center;" },
attributes: { style: "text-align:center !important;padding-right: 25px;" },
filterable: {
ui: function (element) {
element.kendoDatePicker({
format: "MMM dd, yyyy"
});
}
}
}
]
});
});
は、今私は私のニーズのためにこの例を変更:だから私は、私が期待どおりに動作しており、実行されている例を発見しました。 JSONデータを返すREST API呼び出しを使用しています。データはグリッドに表示されますが、フィルタを作成しようとするとデータが失われます。何かが日付形式に間違っているようですが、何が正しい方法があるのか分かりません。
<div id="grid"></div>
<script>
$(document).ready(function() {
$("#grid").kendoGrid({
dataSource: {
transport: {
read: {
url: "http://localhost/FPT2015.WebApp/api/BereitschaftszeitStammdaten",
dataType: "json"
}
},
schema: {
data: "d.results",
model: {
fields: {
stundeVon: { type: "date" }
}
}
, parse: function (data) {
$.each(data.d.results, function (i, val) {
val.stundeVon = new Date(val.stundeVon);
});
return data;
}
},
pageSize: 20,
serverPaging: true,
serverFiltering: true,
serverSorting: true
},
height: 550,
filterable: true,
sortable: true,
pageable: true,
columns: [
{
field: "stundeVon",
title: "Order Date",
format: "{0:MMM dd, yyyy}",
parseFormats: "{0:MM/dd/yyyy}",
headerTemplate: '<label for="check-all"><b>Start Date</b></label>',
headerAttributes: { style: "text-align: center;" },
attributes: { style: "text-align:center !important;padding-right: 25px;" },
filterable: {
ui: function (element) {
element.kendoDatePicker({
format: "MMM dd, yyyy"
});
}
}
}
]
});
});
そして、これは私のAPIが戻ることを、JSONです::ここに私のコードです
{
"d":{
"__count":6,
"results":[
{
"bereitschaftszeitId":2,
"bereitschaftlerId":1,
"stundeVon":"2015-11-25T06:00:00+01:00",
"stundeBis":"2015-12-07T07:00:00+01:00"
},
{
"bereitschaftszeitId":5,
"bereitschaftlerId":2,
"stundeVon":"2015-12-07T06:00:00+01:00",
"stundeBis":"2015-12-14T06:00:00+01:00"
},
{
"bereitschaftszeitId":7,
"bereitschaftlerId":1,
"stundeVon":"2016-01-10T10:00:00+01:00",
"stundeBis":"2016-01-17T10:00:00+01:00"
},
{
"bereitschaftszeitId":12,
"bereitschaftlerId":13,
"stundeVon":"2016-01-03T10:00:00+01:00",
"stundeBis":"2016-01-10T10:00:00+01:00"
},
{
"bereitschaftszeitId":15,
"bereitschaftlerId":2,
"stundeVon":"2016-01-18T06:00:00+01:00",
"stundeBis":"2016-02-19T06:00:00+01:00"
},
{
"bereitschaftszeitId":44,
"bereitschaftlerId":2,
"stundeVon":"2016-03-11T12:06:21.207+01:00",
"stundeBis":"2017-03-11T00:06:00+01:00"
}
]
}
}
誰も私が間違ってここにやって、見ていますか?あなたが私を助けることができれば、私はうれしいでしょう。
ありがとう、私はそれをチェックします! – MrLorKa