Hello,
I would like to apply a template on a column of an editable hierarchical grid.
To do this I use the template property of the column and write a conditionnal template.
My template depends on other colonne so I tested it ad describe in your template engine documentation.
My problem appears when I want to test a boolean column that have the template property set. The get value in the template is not the boolean but a string containing the default checkbox template.
Is there a way to get the value instead of this string ?
I hosted a sample to show you how I did it : http://sdrv.ms/1b0JtSO.
Regards.
Hello Coso,Thank you for your reply ! Glad that the column formatter approach works for you.Just to clarify, using render checkboxes with bool columns alongside column templates is currently a limitation in igGrid, as there is no way to check whether a column is a checkbox rendered column using templates:
help.infragistics.com/doc/jQuery/2013.2/CLR4.0/?page=Known_Issues_and_Limitations_2013_Volume_2.html
Using column formatter is therefore the suggested approach in this scenario.
Hello Petar,
Thanks for your solution it works fine.
Hello Cosoluce_Stones,
Thank you for your reply.
I will need to do some additional testing with the column templates in order to gain more information regarding this scenario. In the meantime as an alternative, I can suggest re-enabling checkbox rendering and using the columnformatterinstead:
{ key: "bool2", headerText: "Bool 2", formatter: function(bool2, row) { if (!row.bool1) { return templateCheckboxGray; } else if (row.bool2) { return templateCheckboxNormalePurple; } else { return templateCheckboxNormaleGreen; } }, dataType: "bool", width: "150px" } , { key: "bool3", headerText: "Bool 3", formatter: function(bool3val, row) { if (!row.bool1) { return templateCheckboxGray; } else if (row.bool3) { return templateCheckboxNormalePurple; } else { return templateCheckboxNormaleGreen; } }, dataType: "bool", width: "150px" }
Thanks for your response, it works, but with the renderCheckboxes property set to false, the editor is no longer a checkbox but a combobox with true and false.
Is there a way to get back the checkbox in editing ?
regards.
In this scenario, in order to ensure that the value of the cell is returned rather than the rendered html (when self invoking), therenderCheckboxesoption of the child layout should be disabled. As templating is used in this scenario, rendering the checkboxes in the bool columns is not necessary beforehand. Attached is you modified sample illustrating this.
Hope this helps. Please do not hesitate to contact me with any questions.