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

[Solved] checkbox inline edit mode not showing in edit mode

1 Answer 35 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
j
Top achievements
Rank 1
j asked on 10 Nov 2011, 03:59 PM
Hi,  when I click the edit button on my row, the checkbox does not show up, just a regular text box.  Here is my view:
@{
    ViewBag.Title = "TableEditor";
}
@(Html.Telerik().Grid<MakeModelMaintenanceEditor.Models.O_MK_MDL_VRFCTN>()
        .Name("Grid")
        .DataKeys(keys => keys.Add(o => o.MAKE_MODEL_ID))
        .DataBinding(dataBinding => dataBinding.Ajax()
                        .Select("_TableEditor""O_MK_MDL_VRFCTN")
                .Insert("InsertEditing""O_MK_MDL_VRFCTN")
                .Update("SaveEditing""O_MK_MDL_VRFCTN")
                .Delete("DeleteEditing""O_MK_MDL_VRFCTN"))
        .Columns(columns =>
            {
                columns.Bound(o => o.DISPLAY_IN_AUTORATES).Width(50);
                columns.Bound(o => o.DisplayAutorates).Width(50)
                   .ClientTemplate("<input type='checkbox' disabled='disabled' name='DisplayAutorates' value=<#= DisplayAutorates #> <#= DisplayAutorates #>/>")
                   .HtmlAttributes(new { style = "text-align:center" });                  columns.Command(commands =>                 {                     commands.Edit().ButtonType(GridButtonType.BareImage);                     commands.Delete().ButtonType(GridButtonType.BareImage);                 }).Width(60);             })             .ClientEvents(events => events                 .OnEdit("onEdit")                 .OnLoad("onLoad")                   .OnRowDataBound("onRowDataBound"))                                                       .Pageable(paging =>                     paging.PageSize(15)                 )             .ToolBar(commands => commands.Insert())             .Sortable()             .Groupable()             .Filterable()             .Selectable()             .Resizable(resizing => resizing.Columns(true))                         )       @section HeadContent {     <script type="text/javascript">         function onEdit(e) {             $(e.form).find('#T_P').data('tDropDownList').select(function (dataItem) {                 return dataItem.Text == e.dataItem['T_P'];             });             $(e.form).find('#DisplayAutorates').data('tDropDownList').select(function (dataItem) {                 return dataItem.Text == e.dataItem['DisplayAutorates'];             });         }     </script>       <script type="text/javascript">           function onRowDataBound(e) {               var dataItem = e.dataItem;               var $checkbox = $(e.row).find(':checkbox');               $checkbox.val(dataItem.pao);               if (dataItem.pao) {                   $checkbox.attr('checked'true);               }           }     </script>     } <script>     function onLoad(e) {         // get instance to the grid client-side object         var grid = $(this).data("tGrid");         // hide the filtering icons         $(".t-grid-filter"this).hide();         // get the table header (thead) which contains all grid column header elements         var thead = $(this).find("thead:first");         // create the filtering row         var tr = $("<tr>").appendTo(thead);         // get all column header cells         var th = thead.find("th:not(.t-group-cell,.t-hierarchy-cell)");         $.each(grid.columns, function (index, column) {             // create a cell which will contain the filtering UI             var cell = $("<th class='t-header'>&nbsp;</th>").appendTo(tr);             // check if the column is filterable             if (th.eq(index).find(".t-grid-filter").length) {                 var timeout;                 // create the filtering textbox                 var textbox = $("<input>").keyup(function (e) {                     // uncomment the following if you want to filter only when ENTER is pressed                     //if (e.keyCode != 13) {                     //    return;                     //}                     // get the updated value of the textbox                     var value = this.value;                     // create the filtering expression - check here for more options: http://www.telerik.com/help/aspnet-mvc/telerik-ui-components-grid-client-api-and-events.html#filter                     var filterExpr;                     if (column.type == "String") {                         filterExpr = column.member + "~substringof~'" + value + "'";                     } else {                         filterExpr = column.member + "~eq~" + value;                     }                     // clear any pending filtering requests - timeout is needed to avoid sending too many requests                     clearTimeout(timeout);                     // filter the grid after 100 milliseconds                     timeout = setTimeout(function () {                         grid.filter(filterExpr);                     }, 100);                 });                 // append the texbox to the filter cell ---                 cell.empty().append(textbox);             }         });     } </script>

1 Answer, 1 is accepted

Sort by
0
j
Top achievements
Rank 1
answered on 10 Nov 2011, 11:39 PM
I was able to solve the issue by making sure by bound data for combo box was boolean.  
Tags
Grid
Asked by
j
Top achievements
Rank 1
Answers by
j
Top achievements
Rank 1
Share this question
or