Reputation: 19163
I am working with KendoUI grid. I want to assign an array as data-source to the grid instead of using array of objects.
dataSource: [
[ "User One", 3 ],
[ "User Two", 3 ]
]
instead of using
dataSource: [
{ name: "User One", age: 3 },
{ name: "User Two", age: 3 }
]
Is this possible?
Upvotes: 3
Views: 5470
Reputation: 636
It is possible, but it's not completely functional. It only works "to some extent" and certain things won't work(I.E. Editing and selection).
In the linked post they also mention that they don't have any plans to implement it, though that was a few years ago.
var source = [
[ "User One", 3 ],
[ "User Two", 33 ]
];
$('#myGrid').kendoGrid({
columns: [
{ field: "[0]", title: "User" },
{ field: "[1]", title: "Number" }
],
dataSource: {
data: source
}
});
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="//kendo.cdn.telerik.com/2015.3.1111/styles/kendo.common-material.min.css" />
<link rel="stylesheet" href="//kendo.cdn.telerik.com/2015.3.1111/styles/kendo.material.min.css" />
<script src="//kendo.cdn.telerik.com/2015.3.1111/js/jquery.min.js"></script>
<script src="//kendo.cdn.telerik.com/2015.3.1111/js/kendo.all.min.js"></script>
</head>
<body>
<div id="myGrid"></div>
</body>
</html>
Upvotes: 2