I have a KenodGrid and I have field whose data is combination of two fields from the data. How would I be able to sort the Column based on the data of one field. Here is the column I have:
{
field: "Owner",
filterable: false,
sortable: true,
template: function(data) {
return data.OwnerFirstName + ' ' + data.OwnerLastName;
}
},
I want to sort the column on either OwnerFirstName or OwnerLastName but want to display both in the grid.
You have to make it into 2 columns to be able to sort them apart :
columns: [{
field: "OwnerFirstName ",
title: "Owner first name",
filterable: false,
sortable: true
}, {
field: "OwnerLastName",
title: "Owner lastname",
filterable: false,
sortable: true
}]
Kendo grid sort table based on defined field for the column in configuration, using a template doesn't effect it. So if you add OwnerFirstName or OwnerLastName to your column field it will sort it will sort your table perfectly.
columns: [
{ field: "OwnerFirstName",
title:"owner",
filterable: false,
sortable: true,
template: function(data) {
return data.OwnerFirstName + ' ' + data.OwnerLastName;
}
},
....
]
Here is a working demo http://dojo.telerik.com/IPeVI
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.