Web Grid UI MVC In-cell/batch edit with a bool? column I still get drop list when clicking next to checkbox.

2 posts, 0 answers
  1. Doug
    Doug avatar
    3 posts
    Member since:
    May 2015

    Posted 26 Aug Link to this post

    So I'm using 2016.1.412 Telerik controls.  MVC Grid UI.

     

    I've followed this (http://www.telerik.com/support/code-library/checkbox-column-and-incell-editing) in order to get one of my boolean? columns to only show a checkbox and allow single click changes.  It works if I very carefully click on the check box.  If I click (within the cell) but next to the check box I get the drop list with the values "true, false, not set".  How do I get rid of the drop list?

     

    1.columns.Bound(p => p.SendTo).Template(@<text></text>).ClientTemplate("<input type='checkbox' #= SendTo ? checked='checked':'' # class='sendtochkbx'/>")
    2.  .Title(GridColumns.SendToPorzio)
    3.  .Filterable(true)
    4.  .HtmlAttributes(new { style = "text-align: center;" })
    5.  .Sortable(false)
    6.  .Width(150)
    7.  .Locked(true)
    8.  .HeaderTemplate("Send To Porzio <input type='checkbox' id='masterCheckBox' onclick='checkAll(this)'/>   ");

    1.$("#SpendGrid").on('click',
    2.    '.sendtochkbx',
    3.    function () {
    4.        var checked = $(this).is(':checked');
    5.        var dataItem = grid.dataItem($(this).closest('tr'));  //grid is defined earlier in code block
    6.        dataItem.set('SendTo', checked);
    7.    });

  2. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 30 Aug Link to this post

    Hi Doug,

    When you use ClientTemplate you need to ensure that you escape the hash symbols. Check out the following article for additional information on using templates.


    Also, make sure that the SendTo field is defined as boolean in the Model. By default the boolean fields will have checkbox editors rendered.

    Regards,
    Viktor Tachev
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top