I want to create a column in the grid with hyperlink to "View" a popup for details of a record. I can easily create this as a button with
columns.Command(command =>
{
command.Custom("View").Click("showDetails");
}
and then
function showDetails(e) {
e.preventDefault();
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
var wnd = $("#Details").data("kendoWindow");
wnd.content(detailsTemplate(dataItem));
wnd.center().open();
However, what I'd like to do is something like
columns.Template(@<text></text>).ClientTemplate(@"<a onclick=""showDetails(#= ID#)"" href=""javascript:void(0)"">View</a>");
Obviously this does not work as the parameter for showDetails(...) is not the id. I'm not able to figure out how to do this manually. Nor am I able to see if my proposed way of doing this is appropriate or perhaps there is a much better way to achieve this?
I have successfully done this for Edit and Delete like this:
columns.Template(@<text></text>).ClientTemplate(@"<a class=""k-button-icontext k-grid-edit"" href=""\#"">Edit</a>").Width(30);
columns.Template(@<text></text>).ClientTemplate(@"<a class=""k-button-icontext k-grid-delete"" href=""\#"">Delete</a>").Width(50);
but these are obviously a bit different beasts than the popup view function I want to implement.
I fail to find a solution for this in other forum posts. My apologies if this has been covered already.
Best regards,
Baldvin
columns.Command(command =>
{
command.Custom("View").Click("showDetails");
}
and then
function showDetails(e) {
e.preventDefault();
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
var wnd = $("#Details").data("kendoWindow");
wnd.content(detailsTemplate(dataItem));
wnd.center().open();
However, what I'd like to do is something like
columns.Template(@<text></text>).ClientTemplate(@"<a onclick=""showDetails(#= ID#)"" href=""javascript:void(0)"">View</a>");
Obviously this does not work as the parameter for showDetails(...) is not the id. I'm not able to figure out how to do this manually. Nor am I able to see if my proposed way of doing this is appropriate or perhaps there is a much better way to achieve this?
I have successfully done this for Edit and Delete like this:
columns.Template(@<text></text>).ClientTemplate(@"<a class=""k-button-icontext k-grid-edit"" href=""\#"">Edit</a>").Width(30);
columns.Template(@<text></text>).ClientTemplate(@"<a class=""k-button-icontext k-grid-delete"" href=""\#"">Delete</a>").Width(50);
but these are obviously a bit different beasts than the popup view function I want to implement.
I fail to find a solution for this in other forum posts. My apologies if this has been covered already.
Best regards,
Baldvin