Hi all,
Below is a cut of from my JS, CS, etc of how I create the kendo GRID. For IE9 after the read() the ajax call hangs and nothing is populated. On FF, Chrome it works fine. What do I do wrong. Please help.
// templates
<script id="rowTemplate" type="text/x-kendo-template">
<tr style="height: 24px;">
<td colspan="1">
#= Id #
</td>
</tr>
</script>
<script id="altRowTemplate" type="text/x-kendo-template">
<tr class="k-alt" style="height: 24px;">
<td colspan="1">
#= Id #
</td>
</tr>
</script>
// createGrid
function createGrid(gridId, locale, controller, action) {
$(document).ready(function () {
grid = $(gridId).kendoGrid({
dataSource: {
transport: {
read: {
url: "/" + locale + "/" + controller + "/" + action,
type: "POST",
},
parameterMap: function (options) {
return JSON.stringify(options);
},
pageSize: 10
},
schema: {
data: function (response) {
var d = JSON.parse(response);
return d.Data;
},
total: function (response) {
var d = JSON.parse(response);
return d.Count;
},
errors: function (response) {
if (response.Errors !== undefined) {
alert(response.Errors.e.errorThrown);
}
}
},
error: function (e) {
alert("Received error: " + e.errorThrown);
},
total: 0,
page: 1,
pageSize: 10,
filter: [],
serverPaging: true,
serverFiltering: true,
serverSorting: true,
serverGrouping: true,
serverAggregates: true
},
autoBind: false,
groupable: false,
selectable: true,
scrollable: false,
rowTemplate: kendo.template($("#rowTemplate").html()),
altRowTemplate: kendo.template($("#altRowTemplate").html()),
pageable: true,
columns: [{ field: "Id", width: 40, groupable: false, encoded: true }],
});
});
$(gridId).data("kendoGrid").dataSource.read();
}
// controller
[HttpPost]
public string GetEmployees(KendoGridDataSourceRequest request)
{
if (_usersLoaded == null)
{
var users = _userService.FindUsersByName("a%", null, 12);
_usersLoaded = ViewModelBuilder.CreateEmployeeItemVMList(users).ToList();
}
var items = _usersLoaded.Skip(request.Skip).Take(request.Take).ToList();
var jsonString = JsonConvert.SerializeObject(new
{
Data = items,
Count = _usersLoaded.Count()
});
return jsonString;
}
Below is a cut of from my JS, CS, etc of how I create the kendo GRID. For IE9 after the read() the ajax call hangs and nothing is populated. On FF, Chrome it works fine. What do I do wrong. Please help.
// templates
<script id="rowTemplate" type="text/x-kendo-template">
<tr style="height: 24px;">
<td colspan="1">
#= Id #
</td>
</tr>
</script>
<script id="altRowTemplate" type="text/x-kendo-template">
<tr class="k-alt" style="height: 24px;">
<td colspan="1">
#= Id #
</td>
</tr>
</script>
// createGrid
function createGrid(gridId, locale, controller, action) {
$(document).ready(function () {
grid = $(gridId).kendoGrid({
dataSource: {
transport: {
read: {
url: "/" + locale + "/" + controller + "/" + action,
type: "POST",
},
parameterMap: function (options) {
return JSON.stringify(options);
},
pageSize: 10
},
schema: {
data: function (response) {
var d = JSON.parse(response);
return d.Data;
},
total: function (response) {
var d = JSON.parse(response);
return d.Count;
},
errors: function (response) {
if (response.Errors !== undefined) {
alert(response.Errors.e.errorThrown);
}
}
},
error: function (e) {
alert("Received error: " + e.errorThrown);
},
total: 0,
page: 1,
pageSize: 10,
filter: [],
serverPaging: true,
serverFiltering: true,
serverSorting: true,
serverGrouping: true,
serverAggregates: true
},
autoBind: false,
groupable: false,
selectable: true,
scrollable: false,
rowTemplate: kendo.template($("#rowTemplate").html()),
altRowTemplate: kendo.template($("#altRowTemplate").html()),
pageable: true,
columns: [{ field: "Id", width: 40, groupable: false, encoded: true }],
});
});
$(gridId).data("kendoGrid").dataSource.read();
}
// controller
[HttpPost]
public string GetEmployees(KendoGridDataSourceRequest request)
{
if (_usersLoaded == null)
{
var users = _userService.FindUsersByName("a%", null, 12);
_usersLoaded = ViewModelBuilder.CreateEmployeeItemVMList(users).ToList();
}
var items = _usersLoaded.Skip(request.Skip).Take(request.Take).ToList();
var jsonString = JsonConvert.SerializeObject(new
{
Data = items,
Count = _usersLoaded.Count()
});
return jsonString;
}