i'm using kendo grid with PHP Wrapper ... When formatting my column i use template, but i can't pas the #:ColmunValue# to the getColorForValue function.
<script id="ColumnTemplate" type="text/x-kendo-tmpl">
<div style="background-color: <?php echo '\\'.$colors->getColorForValue(#:ColmunValue#); ? >;">
#:ColmunValue#
</div>
</script>
I tried a second solution:
$Column = new \Kendo\UI\GridColumn();
$Column->field('ColumnName')
->title(' ')
->attributes(' bgcolor = '.getColorForValue(#: Column #) )
->templateId('ColumnTemplate')
->width(55);
but both are not working :( Any Idea ?
There should not be any PHP code in the rowTemplate (if it depends on the value of the row). You can use client expression and functions like shown here.
<script id="ColumnTemplate" type="text/x-kendo-tmpl">
<div style="background-color: #= someFunction(data.PersonName) #">
#= PersonName#
</div>
</script>
<script>
someFunction(name){
// some logic here and then return color based on the name
return "red";
}
</script>