Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 612
shubham gupta Avatar asked Dec 20 '22 03:12

shubham gupta


1 Answers

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

like image 147
himawan_r Avatar answered Dec 24 '22 03:12

himawan_r