3

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?

1 Answer 1

2

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>

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for quick answer !!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.