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

Kendo Grid - replace existing value with new

2 Answers 416 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kirubakaran
Top achievements
Rank 1
Kirubakaran asked on 08 Apr 2020, 01:50 PM

Below is my coding.

Here i want to do a if condition in "Comments" column. if comments available then i need to replace it as "1". if its empty then "0".

1. Either i can introduce new column at the end and apply the above condition and hide the "Comment" column (as this value depend on child row)

2. or directly modify the comment column

 

<div id="grid"></div>
                    <button id="btnprint" type="submit" name="excel" value="valexcel">Print</button>
<script> $("#grid").kendoGrid({ columns: [{ field: "productName" }, { field: "category" }, { field: "status" }, { field: "Comments" }], dataSource: { data: [{ productName: "Tea", category: "Beverages", status: "Open", "Comments": "" }, { productName: "Coffee", category: "Beverages", status: "Open", "Comments": "comment1" }, { productName: "Ham", category: "Food", status: "Open", "Comments": "" }, { productName: "Bread", category: "Food", status: "Open", "Comments": "" }, { productName: "Hammer", category: "Hardware", status: "Closed", "Comments": "Comment test" }, { productName: "Screw", category: "Hardware", status: "Open", "Comments": "commenting testing" }], group: { field: "category" } },  detailTemplate: "<div class='Comments'>",
                    detailInit: function (e) { e.detailRow.find(".Comments").html("<p>" + e.data.Comments + "</p>"); }, });</script>

2 Answers, 1 is accepted

Sort by
0
Accepted
Silviya Stoyanova
Telerik team
answered on 10 Apr 2020, 01:49 PM

Hello Kirubakaran,

 

I would suggest adding a template to the column "Comments", where to apply the conditional clause for available comments.

You can see a runnable example here.

 

Kind Regards, Silviya Stoyanova Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Kirubakaran
Top achievements
Rank 1
answered on 14 Apr 2020, 04:40 AM
Thanks Silviya.
Tags
Grid
Asked by
Kirubakaran
Top achievements
Rank 1
Answers by
Silviya Stoyanova
Telerik team
Kirubakaran
Top achievements
Rank 1
Share this question
or