Hey,
I am trying to use the framework but am having difficulties. Im using the below code to populate the grid (like in the example, http://demos.telerik.com/kendo-ui/web/grid/index.html).
When I try to implement this code using a template to add a checkbox, it breaks. How do i achieve this?
I am trying to use the framework but am having difficulties. Im using the below code to populate the grid (like in the example, http://demos.telerik.com/kendo-ui/web/grid/index.html).
When I try to implement this code using a template to add a checkbox, it breaks. How do i achieve this?
<
script
>
$(document).ready(function () {
$("#grid").kendoGrid({
dataSource: {
type: "odata",
transport: {
},
pageSize: 10
},
groupable: true,
sortable: true,
pageable: {
refresh: true,
pageSizes: true,
buttonCount: 5
},
columns: [{
field: "ContactName",
title: "Contact Name",
width: 140,
template: "#= checkbox(ContactTitle)"
}, {
field: "ContactTitle",
title: "Contact Title",
width: 190
}, {
field: "CompanyName",
title: "Company Name"
}, {
field: "Country",
width: 110
}]
});
});
function checkbox(contactTitle) {
if (contactTitle.length > 0) {
return '<
input
type
=
"checkbox"
value
=
"' + contactTitle + '"
checked
=
"checked"
/>';
} else {
return '<
input
type
=
"checkbox"
value
=
"' + contactTitle + '"
/>';
}
}
</
script
>
<
div
id
=
"grid"
style
=
"height: 380px"
></
div
>