How to get all the values of particular column of kendo grid?

shubham gupta picture shubham gupta · Jun 8, 2015 · Viewed 18.6k times · Source

i have kendo grid with 4 columns in it [mac,level,timestamp,message]. i need to store all the values under timestamp column in an array.I tried but couldn't find any way to traverse in a particular column. Any idea how to do this using java script?

Answer

himawan_r picture himawan_r · Jun 8, 2015

Since you're using kendo which you must include jQuery. To make life easier why don't try to use jQuery, as per my suggestion at the moment i don't know any other way but to

  • get & loop through the grid datasource

  • get the date and push it into an array

For example i create button <button id="test">Click here</button> and kendo console <div class="console"><div> so you can see the result after clicking the button. Here goes the code :

$("#test").click(function(){
    var arrayDate = [];
    var data =$("#grid").data("kendoGrid").dataSource._data;
    for(i=0; i<data.length; i++){
      arrayDate.push(data[i].OrderDate);
    }  
    kendoConsole.log(arrayDate);
});

Here is working example for you on kendo dojo