I have a grid that is initialized with a datasource, then the user can choose different options from a form and get a new set of data that needs to be applied to the grid. I can't load the entire dataset to the grid and just let the grid filter the data because the dataset would be too large so I need to set a brand new dataset each time (note: the number of columns and formatting should stay the same). I have it working, EXCEPT, the date format does propagate.
Here is what I have:
function DisplayMeetingsGrid(myMeetings) {
var grid = $("#grid").data("kendoGrid");
if (typeof grid === 'undefined') {
$("#grid").kendoGrid({
dataSource: {
data: myMeetings,
schema: {
model: {
fields: {
MeetingDate: { type: "date" }
}
}
},
},
groupable: true,
sortable: true,
filterable: true,
pageable: {
refresh: false,
pageSizes: [10, 20, 50, 100],
buttonCount: 5,
pageSize: 10,
input: true
},
columns: [{
field: "MeetingName",
title: "Name",
width: 220,
template: "<
a
href
=
'/${URLBase}/meeting/view/${MeetingId}/'
>${MeetingName}</
a
>",
filterable: true
}, {
field: "MeetingDate",
title: "Date",
width: 90,
format: "{0:M/d/yyyy}",
filterable: {
ui: "datepicker"
}
}, {
field: 'StartTime',
title: "Start Time",
template: "${StartTime} <
a
style
=
'float: right;'
data-mid
=
'${MeetingId}'
title
=
'Add this Meeting to your calendar'
class
=
'ical iCalendarLink'
>Add to your calendar</
a
>",
width: 108,
filterable: false
}, {
field: "Location",
title: "Location",
width: 200,
filterable: true
}, {
field: 'agenda',
template: kendo.template($("#agendas-template").html()),
title: "Agendas (Group)",
filterable: false,
sortable: false,
groupable: false
}]
});
} else {
//WHEN THIS CODE IS HIT, THE DATE FORMAT IS LOST! <---------------
$("#grid").data("kendoGrid").dataSource.data(myMeetings);
}
}
Any help is appreciated.