Is there a way to turn off label generation of a boolean in the cell of a grid

2 Answers 69 Views
Checkbox Grid
Daniel
Top achievements
Rank 1
Iron
Daniel asked on 23 May 2022, 04:23 PM

When using the Boolean editor template with the grid HtmlHelper a label is created in the cell next to the checkbox. This was not always the case. Older versions of kendo excluded the label and only rendered the checkbox. Is there a way to turn off the label and only render the checkbox?

 vs 


2 Answers, 1 is accepted

Sort by
0
Accepted
Daniel
Top achievements
Rank 1
Iron
answered on 28 Jun 2022, 07:30 PM

If you add a display name to the model, text is added to the label

E.g.

[DisplayName("Test")]
public bool BooleanTestColumn { get; set; }

produces the following label in the grid cell

<label class="k-checkbox-label" for="BooleanTestColumn">Test</label>

Or, this will also happen if a third party package (Humanizer in my case) adds a display name indirectly.

0
Petar
Telerik team
answered on 24 May 2022, 10:29 AM

Hi Daniel,

The appearance of the column title next to the Boolean editor is not expected behavior for the Grid. For example, you can check our Grid editing demos and see that when editing the "Discontinued" column only a checkbox appears in it. There is no label. 

Based on the available details, what I can suggest as possible approaches for fixing the reported issue are as follows:

  • Option 1: Inspect the label text in the boolean column using the Devtools of your browser. Get a selector and use CSS to hide the unexpected label.
  • Option 2: Prepare an isolated example in which the discussed behavior can be replicated and send it to us. Once we can reproduce the issue, we will furhter investigate what is happening in your project and provide more relevant feedback about it. 

Let me know if you need furhter assistance with your scenario.

Regards,
Petar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Daniel
Top achievements
Rank 1
Iron
commented on 28 Jun 2022, 07:26 PM

Thank you for the reply Petar. I've found the cause. The label always appears in the grid cell but without any text content. This label is not visible to the user.

E.g.

<label class="k-checkbox-label" for="BooleanTestColumn"></label>

If you add a display name to the model, text is added to the label

E.g.

[DisplayName("Test")]
public bool BooleanTestColumn { get; set; }

produces the following label in the grid cell

<label class="k-checkbox-label" for="BooleanTestColumn">Test</label>

Or, this will also happen if a third party package (Humanizer in my case) adds a display name indirectly.

I hope this helps somebody else.

Petar
Telerik team
commented on 29 Jun 2022, 06:50 AM

Hi, Daniel.

Thank you for sharing the solution to the discussed issue with the community! It will surely help someone who has a similar to your scenario. 

Tags
Checkbox Grid
Asked by
Daniel
Top achievements
Rank 1
Iron
Answers by
Daniel
Top achievements
Rank 1
Iron
Petar
Telerik team
Share this question
or