logo
Tags down

shadow

Kendo grid column template for column with values


By : n00bProgramming
Date : October 14 2020, 02:24 PM
fixed the issue. Will look into that further You can do with help of attribute by condition.
Here code for your reference.
code :
  <style>
.red{
    color:red;
}

.green {
    color:green;
}
</style>
<script>
$("#grid").kendoGrid({
columns: [
{ field: "productName" },
{ field: "category", values: [
{ text: "Beverages", value: 1 },
{ text: "Food", value: 2 }
],attributes: {
            class: "#=category ==1 ? 'red' : 'green' # #console.log(data)#"
          } }
],
dataSource: [
{ productName: "Tea", category: 1 },
{ productName: "Ham", category: 2 }
]
});
</script>


Share : facebook icon twitter icon

Kendo Grid column with Kendo Menu template


By : sathish
Date : March 29 2020, 07:55 AM
this will help Grid table cells have an overflow:hidden style applied by default. You can override it with
code :
.k-grid tr td
{
     overflow:visible;
}

Use column.values together with row template in Kendo UI Grid


By : user1995473
Date : March 29 2020, 07:55 AM
wish helps you I finally contacted Kendo support team with this issue. Solution is to get reference to the column, iterate over the values and show the text from the item which has value == GroupId.
code :
<script id="usersTableRowTemplate" type="text/x-kendo-tmpl">  
<tr data-uid="#= uid #">
    <td>#: Name #</td>
    <td>#: textForGroup(GroupId) #</td>
</tr>
</script>

<script>
function textForGroup(id) {      
    var values = $("#usersTable").data("kendoGrid").columns[1].values;

    var item = $.grep(values, function(item, _) {               
        return item.value === id;
    })[0];

    return item ? item.text : "";
}
</script>

How to customize column template when kendo grid column is auto generated?


By : Nitchel Blackwood
Date : March 29 2020, 07:55 AM
should help you out I assign the datasource into the Kendo grid using javascript: , I post my solution here, maybe it could help someone in future.
code :
    var customColumns =  [{
            template: "<input type='checkbox' class='checkbox' />",
            width: 20
        }];
    for (var i = 0; i < customHeaders.length; i++) {
    if (i > 4) // after Name, Description, Region etc..
    {
        if (i == 5) // start with the first price column
        {
            customColumns.push({ 
                title : customHeaders[i], 
                field: headers[i],
                width: 150,
                template:
                    "# if(" + headers[i] + " != null) {# " +
                    "#= kendo.toString(" + headers[i] + ", 'n') #" +
                    "# } else { #" +
                    "" +
                    "#} # ",
                aggregates: ["sum", "average"],
                groupFooterTemplate: "Sum: #= kendo.toString(sum, '0.00') # || Average: #= kendo.toString(average, '0.00') #"
            });
        }
        else // compare price with previous year
        {
            customColumns.push({ 
                title : customHeaders[i], 
                field: headers[i],
                width: 150,
                template:
                    "# if(" + headers[i] + " != null) {# " +
                    "#= calculatePercentage(" + headers[i-1] + ", " + headers[i] + ") #" +
                    "# } else { #" +
                    "" +
                    "#} # ",
                aggregates: ["sum", "average"],
                groupFooterTemplate: "Sum: #= kendo.toString(sum, '0.00') # || Average: #= kendo.toString(average, '0.00') #"
            });
        }
    }
    else
    {
        customColumns.push({ 
            title : customHeaders[i], // customized header
            field: headers[i] // original header
        });
    }
}

In angular grid, I have a column with an editor template (reactive form) in inline Kendo grid. It doesn't link template


By : synspark
Date : March 29 2020, 07:55 AM

kendo UI- conditional column in kendo ui grid base on column values


By : user5051907
Date : March 29 2020, 07:55 AM
hope this fix your issue I am having trouble using kendo grid column template my scenario is this: , Try this for your ClientTemplate()
Related Posts Related Posts :
shadow
Privacy Policy - Terms - Contact Us © voile276.org