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

General

2 Answers 59 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mohamed
Top achievements
Rank 1
Mohamed asked on 12 Mar 2012, 03:55 PM
Hi,

I’am currently testing Kendo UI Grid.  Our product uses Telerik and would like to move towards Kendo.  I have a general question on the Grid control using Row templates.

Let say I use the following row template that I would like to use with a Grid.  The first cell would be bound to the “Field1” of my object.  The second cell is a link that points to a URL bound to “Field2” of my object.

<script id="MyRowTemplate" type="text/x-kendo-tmpl">
<tr>
  <td>${ Field1 }</td>
  <td><a href=”${Field2}”>click me</a></td>
</tr>
</script>

My question is the following.  How would I insert some logic to remove the link if the “Field2” my object set is empty.
In pseudo code I would like to achieve the following.

If myObject.Field2 = “” then
  Do not generate a link
Else
  Show the link with the Url pointing to MyObject.Field2

In other words I’am trying to find a way to have more control on the html generated when binding fields to a grid.  Not sure if using a Row template is the way to go in my case.  

Thanks in advance.





2 Answers, 1 is accepted

Sort by
0
Accepted
Alexander Valchev
Telerik team
answered on 12 Mar 2012, 06:34 PM
Hello Mohamed,

It is possible to use JavaScript code or call a function inside the template definition. For more information and examples please check the corresponding documentation.

I hope this will help you to solve the problem.

Regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Mohamed
Top achievements
Rank 1
answered on 30 Mar 2012, 03:00 AM
Thanks Alexander.  That answers my question.
Tags
Grid
Asked by
Mohamed
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Mohamed
Top achievements
Rank 1
Share this question
or