This is a migrated thread and some comments may be shown as answers.

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

1 Answer 185 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Doug
Top achievements
Rank 1
Doug asked on 26 Aug 2016, 03:08 PM

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.    });

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 30 Aug 2016, 08:36 AM
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
Tags
Grid
Asked by
Doug
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or