I've been working on getting my Kendo grid to persist across page navigation. I was able to get that to work, but when I set the initial sort to a computed field, the grid will throw an error:
- Uncaught TypeError: d.GetStatus is not a function
d.GetStatus is a computed field, so the error doesn't really surprise me, but I'm not sure how to handle this so that I can set the initial sort to a field that isn't in the original dataSource (without directly modifying the DB response to include the computed value as its own property).
{
dataSource: {
schema: {
model: {
fields: {
'AmountDue'
: {...},
'AmountPaid'
: {...},
'Name'
: {...},
...
},
// Computed Fields
'GetStatus'
:
function
() {
return
this
.AmountPaid >=
this
.AmountDue ?
'Paid'
:
'Due'
;
}
}
},
sort: {
dir:
"asc"
,
field:
"GetStatus()"
}
},
columns: [
...
{
title:
'Status'
,
field:
'GetStatus()'
}
]
}
Is there another way to go about creating this custom "Status" field so that the initial sorting works?