Reputation: 3153
I need to get the displayed text of a kendo grid, while iterating over the data. I have bee doing this:
var data = grid.dataSource.data();
var cols = grid.columns;
for (var ri = 0; ri < data.length; ri++) {
for (ci = 0; ci < cols.length; ci++) {
var val = data[ri].get(cols[col].field);
//do something with the cell data
//but this gets me the model's value, not the displayed text
}
}
How can I get the displayed text in each cell?
Upvotes: 1
Views: 1510
Reputation: 3153
Ok, figured it out.
var data = grid.dataSource.data();
var cols = grid.columns;
var field, template;
for (var ri = 0; ri < data.length; ri++) {
for (ci = 0; ci < cols.length; ci++) {
field = cols[ci].field;
template = cols[ci].template;
if (field) {
var textval = data[ri][field];
if (template) {
var kt = kendo.template(template.toString());
textval = kt(data[ri]);
valType = 'string';
}
//do something with textval here
}
}
}
Upvotes: 2