Kendo Grid showing Yes or No instead of True or False

14 posts, 0 answers
  1. Richard Wilde
    Richard  Wilde avatar
    14 posts
    Member since:
    Jul 2009

    Posted 06 Mar 2012 Link to this post


    On the kendo grid is it possible to substitute True/False for Yes/No?

    My Json returns true or false but I would like the grid to show Yes or No.

    Is this possible or should I return the data from the server as Y/N?
  2. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 07 Mar 2012 Link to this post

    Hello Richard,

    That could be achieved through a column template. Please check the following code snippet:
    columns: [
        { field: "BooleanVal", template: "#= BooleanVal ? 'yes' : 'no' #" }
    ]


    Kind regards,
    Alexander Valchev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Marcel Härry
    Marcel Härry avatar
    28 posts
    Member since:
    Jul 2009

    Posted 15 Feb 2014 in reply to Alexander Valchev Link to this post

    Hi Alexander
    Works fine
    I have my problems with Javascript, so forgive my ignorance.
    Whats about this number signs  # is that a telerik specific template marker?
    Regards

    Marcel
  5. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 17 Feb 2014 Link to this post

    Hi Marcel,

    Yes, the hash symbols are part of Kendo UI Template syntax. You can read more about them in this help topic:

    Regards,
    Alexander Valchev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  6. Senthilkumar
    Senthilkumar avatar
    12 posts
    Member since:
    May 2015

    Posted 27 Jun 2015 Link to this post

    How to retain the check box instead of true or false without using client template?
  7. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 01 Jul 2015 Link to this post

    Hello Senthilkumar,

    It is not possible to include a checkbox in Grid column without template.

    Regards,
    Alexander Valchev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  8. HaBo
    HaBo avatar
    22 posts
    Member since:
    Oct 2011

    Posted 31 Mar in reply to Alexander Valchev Link to this post

    Alexander,

    This will not work when you group by column, there you will still see value as true or false.

    How do you handle over there?

  9. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 05 Apr Link to this post

    Hi HaBo,

    Could you please provide code snippets that shows your current configuration so I can examine it and assist you further?

    Regards,
    Alexander Valchev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  10. HaBo
    HaBo avatar
    22 posts
    Member since:
    Oct 2011

    Posted 05 Apr in reply to Alexander Valchev Link to this post

     

    var tqColumns = [{
                    template: "#= (SendEmails == true ) ? 'Yes' : 'No' #",
                    field: "SendEmails",
                    title: "Emails"
                }
            ];

     

     $("#Grid").kendoGrid({
                dataSource: tqGridData,
                columns: tqColumns,
                //maxheight: 550,
                groupable: true,
                sortable: true,
                pageable: {
                    refresh: true,
                    pageSizes: true,
                    buttonCount: 5
                },
                detailTemplate: kendo.template($("#queueDetails").html()),
                detailInit: detailInit,
                dataBound: function () {
                    // this.expandRow(this.tbody.find("tr.k-master-row").first());
                   
                }
            });

     

     

  11. Mikkel
    Mikkel avatar
    58 posts
    Member since:
    Aug 2012

    Posted 05 Apr in reply to Alexander Valchev Link to this post

    I used the same template in my grid, but when I added a sub grid using the same template, I got an error "Invalid Template".

    After hours and hours of trial and error, I finally found the solution to that problem which was to escape the template hash tags in the subgrid like this:

    columns: [
        { field: "BooleanVal", template: "\#= BooleanVal ? 'yes' : 'no' \#" }
    ]

  12. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 08 Apr Link to this post

    Hi HaBo,

    Your code looks OK. I prepared a sample page which works OK on my side. Can you check it and let me know what I am missing?

    Regards,
    Alexander Valchev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  13. HaBo
    HaBo avatar
    22 posts
    Member since:
    Oct 2011

    Posted 08 Apr in reply to Alexander Valchev Link to this post

    Alexander,

    in your example,group the grid by a Boolean field and and notice the group title.

    I have attached a screen shot.

  14. HaBo
    HaBo avatar
    22 posts
    Member since:
    Oct 2011

    Posted 08 Apr in reply to Alexander Valchev Link to this post

    screen shot did not show up. So adding it again.
  15. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 13 Apr Link to this post

    Hello HaBo,

    For this case use the groupHeaderTemplate:
    • http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#configuration-columns.groupHeaderTemplate
    • example: http://dojo.telerik.com/iQoju/3


    Regards,
    Alexander Valchev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready