I am familiar with having a client template for a Boolean column to display "Yes" or "No" for true or false. I have many templates that use the syntax below with no problems yet this grid on one template will show no data at all if I display that column. If I comment it out the data shows fine.
columns.Bound(a => a.Mosfet.isESD).ClientTemplate("#= isESD ? 'Yes' : 'No' #").Width(80).Title("ESD").Width(100);
I can observe the 5 records that are returned in the grid's Read method in the debugger and see that the non null able column has valid values
Any suggestions?
4 Answers, 1 is accepted
Thank you for the details.
Indeed, the syntax of the template is valid, as if I place it in some of our demos it is working with no issues.
I noticed that the field is a nested one. This could be the reason as the value "isESD" may not be available like this.
I can suggest using the ClientTemplate as a JS function passing the "isESD" as this will allow determining the actual value that is passed on the template:
https://stackoverflow.com/questions/19819127/how-to-call-javascript-method-from-clienttemplate-in-kendo-grid
If the issue still occurs, please provide an example, as the issue could be caused by a factor which we are overlooking at this moment.
Regards,
Stefan
Progress Telerik

Hello Stefan,
I tried about everything this morning to get this working. It still does not work. If I employ the JS function you declare it does not get called and the exception is still thrown, or at least the data does not display in the grid.
I believe the problem has to do with the nested objects. The data type in the grid is a composite object with two nested objects. Any columns other than Boolean in those objects display just fine.
The typical client template syntax at the model's root level has no issues ...
columns.Bound(a => a.Active).ClientTemplate("#= Active ? 'Yes' : 'No' #").Width(120);
Can you provide a little demo with nested objects containing Boolean values in the model sent to the grid?
Thanks
I made an example of the nested object and the same template which is working as expected.
I have attached it for reference.
If the issue still occurs, please modify the provided example or send a new one reproducing it, so we will be able to locate the specific issue.
Regards,
Stefan
Progress Telerik

Hello Stefan,
Thank you for that demo. It works now. The problem was in the syntax of the client template declaration. I was not qualifying the nested object's field with the nested object itself.
Before:
columns.Bound(a => a.Mosfet.IsEOL).ClientTemplate("#= IsEOL ? 'Yes' : 'No' #").Width(100)
After:
columns.Bound(a => a.Mosfet.IsEOL).ClientTemplate("#= Mosfet.IsEOL ? 'Yes' : 'No' #").Width(100)
Thank you for your help.