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

Disable html encoding in grid column

2 Answers 1656 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Glenn Boothe
Top achievements
Rank 1
Glenn Boothe asked on 14 Feb 2018, 10:43 PM

Is there a way to allow html in a column?

<kendo-grid-column field="description" title="Description" [encoded]="false"></kendo-grid-column>

gives me the error  "encoded is not a known property"

<kendo-grid-column field="description" title="Description">
  <ng-template kendoGridCellTemplate let-dataItem>
    {{ htmlDecode(dataItem.description) }}
  </ng-template>
</kendo-grid-column>

Doesn't decode either.

Any solution or workaround?

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimiter Topalov
Telerik team
answered on 15 Feb 2018, 12:01 PM
Hello Glenn,

The Angular framework encodes template values for security reasons by default, and the most straight-forward workaround in the described scenario is to wrap the template Grid cell content in an HTML element, and bind its "innerHTML" property to the desired data item field, e.g.:

https://plnkr.co/edit/oxtJ1gJDf3PLOmSGATuD?p=preview

I hope this helps.

Regards,
Dimiter Topalov
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Glenn Boothe
Top achievements
Rank 1
answered on 16 Feb 2018, 04:34 PM

Thanks Dimiter,

I just assumed that it was Kendo doing the encoding because I'm used to the Kendo for jQuery having the encoded field.

Your solution works for me. Thanks for taking the time to explain that.

Tags
General Discussions
Asked by
Glenn Boothe
Top achievements
Rank 1
Answers by
Dimiter Topalov
Telerik team
Glenn Boothe
Top achievements
Rank 1
Share this question
or