IgniteUI / ignite-ui

Ignite UI for jQuery by Infragistics
https://bit.ly/2kuu1fT
Other
477 stars 84 forks source link

Issues when renderCheckboxes and templates on a boolean column. #2215

Closed IsiAymeric closed 1 year ago

IsiAymeric commented 1 year ago

Description

Hello,

I’m facing a problem I d'like to use renderCheckboxes for some of my boolean column and also for one on my boolean column a template.

The API clearly say that :

"Checkboxes are not rendered for boolean values in columns with a column template"

which means that if there is a template this should override the renderCheckboxes aspect of that column. This works fine if I don't use the column name in the template but when I use it doesn't work.

Steps to reproduce

Here is a fiddle that can reproduce the problem : http://jsfiddle.net/gp8noajd/ Here the template of the column MakeFlag references itself ("{{if MakeFlag == false}}KO{{else}}OK{{/if}}") and it doesn't work. But if I change it to another boolean column then it does work with that column value for example :

{{if FinishedGoodsFlag == false}}KO{{else}}OK{{/if}}

Result

The template is not correctly rendered in the Boolean column cells if renderCheckboxes is enabled and the template reference that column name.

Expected result

The template should render correctly in Boolean column cells with template even if renderCheckboxes is enabled and the template reference that column name.

Attachments

For information that is part of a thread in the forum :

https://www.infragistics.com/community/forums/f/ignite-ui-for-jquery/124923/issues-when-rendercheckboxes-and-templates-on-a-boolean-column

There seems to be a work around but that means for me to do some specific treatments in our engine that configure the columns from their known types automatically, which is a poor design. Can you confirm this issue and tell when will it be corrected ?

IsiAymeric commented 1 year ago

Hello, I would like to know if you can provide any update/news on this bug ? any planification ? Best regards thanks.

ChronosSF commented 1 year ago

Hey @IsiAymeric ,

This behavior is a side-effect of the internal implementation of checkboxes that implements them through the formatter portion of the rendering process. Basically the reason your template doesn't work is that it receives the checkbox html as value instead of true/false. This has some benefits for other scenarios but obviously doesn't help in yours.

We could fix it, though it'll take some time to get the fix in your hands. What I am wondering is if your actual use-case is similar. This is because if you have different text representations of true/false implementing a swap through a formatter makes more sense and will work in this case.

i.e. instead of

{ headerText: "Make Flag", key: "MakeFlag", dataType: "bool", width: "15%" ,template:"{{if MakeFlag == false}}KO{{else}}OK{{/if}}"}

use this:

{ headerText: "Make Flag", key: "MakeFlag", dataType: "bool", width: "15%", formatter: function (val) { return val ? 'OK' : 'KO' }}