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

CheckBoxFor EditorTemplate in Grid

7 Answers 909 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Reafidy
Top achievements
Rank 1
Iron
Reafidy asked on 06 Aug 2017, 07:35 AM

I have a checkbox in a grid:

columns.Bound(p => p.Display);

I also have the following editor template:

@model Boolean
@Html.Kendo().CheckBoxFor(m => m)

During editing the checkbox editor template does show, however the checked state is always false even when the underlying data is true.

7 Answers, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 09 Aug 2017, 02:13 PM
Hello Reafidy,

In order to change the default editor widget for a field, it is necessary to specify the name of the editor in the model using DataAnnotations UIHint attribute. 

e.g.
public class YOUR_MODEL
    ...
  
 [UIHint("Boolean")] // Boolean is the name of the view that contains the editor
 public bool Display{ get; set; }
  
    ...
  
}

The following article illustrate illustrates the aforementioned approach step by step:



Regards,
Georgi
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Reafidy
Top achievements
Rank 1
Iron
answered on 10 Aug 2017, 11:49 PM

Sorry I should have mentioned I have already set the UIhint attribute:

[UIHint("Boolean")]
public Boolean Display { get; set; }

 

If I switch to a standard checkbox (as below) it works fine, so why would the kendo checkbox not work correctly?

@model Boolean
 
@*@Html.Kendo().CheckBoxFor(m => m)*@
<div class="editor-for">
    @Html.CheckBox("", Model, new { @class = "tickbox-single-line" })
</div>

 

0
Viktor Tachev
Telerik team
answered on 15 Aug 2017, 02:24 PM
Hi,

Currently there is an issue that affects the Kendo CheckBox binding when it is used as editor in the Grid component. The developers are aware of this and are doing their best to provide a fix as soon as possible. 

Until a fix is available I would suggest using a regular CheckBox. I apologize for any inconvenience this may cause you.


Regards,
Viktor Tachev
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Reafidy
Top achievements
Rank 1
Iron
answered on 02 Sep 2017, 11:48 PM

Is there somewhere I can track the progress on this?

0
Accepted
Georgi
Telerik team
answered on 06 Sep 2017, 02:04 PM
Hello Reafidy,

You can track the issue in the following link:



Regards,
Georgi
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Frederic
Top achievements
Rank 1
answered on 02 Oct 2017, 07:05 PM

Is it possible that this issue affects not only the CheckBox but also the DatePicker?

I just played around with the Grid control and some other Kendo elements within the grid using Editor Templates.

Ordinary text boxes, numeric text boxes and DropDownLists work fine, but the DatePicker and the CheckBox do not.

In both cases, values disappear when switching into edit mode (InLine).

Furthermore, values get lost when switching back into read mode.

This indicates that bindings obviously do not work in any direction.

0
Viktor Tachev
Telerik team
answered on 05 Oct 2017, 02:30 PM
Hi Frederic,

Please ensure that the editors are defined as [WidgetName]For. In that case the relevant field in the Model should be bound to the respective editor automatically. 

In case the behavior persists please send us a runnable sample where it is replicated so we can examine it.

Regards,
Viktor Tachev
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Reafidy
Top achievements
Rank 1
Iron
Answers by
Georgi
Telerik team
Reafidy
Top achievements
Rank 1
Iron
Viktor Tachev
Telerik team
Frederic
Top achievements
Rank 1
Share this question
or