I want to add a hyperlink in my Kendo UI Grid. from data source I am getting a URL back and I just want to to display it as a hyperlink . below is a sample code . Please suggest me the simplest way to do that.
<div id="testGrid" data-role="grid" data-bind="source: sampleData"
data-sortable="true" data-resizable="true" />
$(document).ready(function(){
var sampleData = [
{ "Title": "The Code Project", "URL": "http://codeproject.com/","Developer":"Tom Hanks" },
{ "Title": "Kendo UI", "URL": "http://kendoui.com/" ,"Developer":"Tom Cruise"}
];
var ddatasource= new kendo.data.DataSource.create(sampleData);
$("#testGrid").kendoGrid({
dataSource: ddatasource,
columns: [{ field: "Title", title: "Title Name"},
{ field: "URL", title: "URL :"}]
});
});
You can do this with a template:
columns: [{ field: "Title", title: "Title Name"},
{ field: "URL", title: "URL :", template: '<a href="#=URL#">#=Title#</a>'}]
You can try it out on the Kendo Dojo here: http://trykendoui.telerik.com/aFAR
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With