or
function refreshKendoGrid(gridId) {
var grid = $(gridId).data("kendoGrid");
//reload grid's datasource
grid.dataSource.read();
// refreshes the grid
grid.refresh();
}
[code]
<div id=
"grid"
></div>
<script type=
"text/javascript"
>
$(document).ready(
function
() {
kendo.culture(
"ru-RU"
);
var
dataSource =
new
kendo.data.DataSource({
transport: {
read: { url:
"http://localhost:6356/admin/GetUnitTogglesList"
},
update: { url:
"http://localhost:6356/admin/UpdateUnitToggles"
},
destroy: { url:
"http://localhost:6356/admin/DeleteUnitToggles"
},
create: { url:
"http://localhost:6356/admin/CreateUnitToggle"
}
},
batch:
true
,
schema: {
model: {
fields: {
Date: { type:
"date"
},
UnitId: { type:
"number"
},
Connect: { type:
"boolean"
}
}
}
}
});
dataSource.read();
$(
"#grid"
).kendoGrid({
dataSource: dataSource,
navigatable:
true
,
pageable:
false
,
sortable:
true
,
toolbar: [
"create"
,
"save"
,
"cancel"
],
columns: [
{ field:
"Date"
, title:
"Date"
, template:
'#= kendo.toString(Date, "dd.MM.yyyy H:mm") #'
, editor: timeEditor },
{ field:
"UnitId"
, title:
"Unit"
},
{ field:
"Connect"
, title:
"Status"
}
],
editable:
true
});
});
function
timeEditor(container, options) {
$(
'<input name="'
+ options.field +
'"/>'
)
.appendTo(container)
.kendoDateTimePicker({
format:
"dd.MM.yyyy H:mm"
,
timeFormat:
"H:mm"
});
}
</script>