I can't seem to find the answers to these questions.
1) Can you apply a double click to the row when server binding the grid, I've tried the following code in the OnDataBound function but it doesn't execute when double clicking the row?
2) I could also use a custom command button as well instead of the double click, but I can't find a handle to the row when I fire the the following script.
Double Click row script.
$(that.tbody).on(
"dblclick"
,
"tr"
,
function
(e) {
var
rowData = that.dataItem(
this
);
CheckForTemplate(rowData.Id);
});
Custom Command button script.
columns.Command(command =>
{
command.Custom("Datasheet").Click("ViewDatasheet")
}).Width(200);
function
ViewDatasheet(e) {
e.preventDefault();
var
dataItem =
this
.dataItem($(e.currentTarget).closest(
"tr"
));
-> This line causes the attached script error.
idcount = dataItem.Id;
$.ajax({
type:
"POST"
,
url:
'@Url.Action("CheckForAssignedTemplate", "Data")'
,
contentType:
"application/json; charset=utf-8"
,
data: JSON.stringify({ moduleid: @Model.TheModule.Id, idcount: idcount }),
dataType:
"json"
,
success:
function
(result) {
if
(result.datasheetid !==
""
) {
location.href =
'@Url.Action("Index", "Datasheet")?datasheetid='
+ result.datasheetid;
}
else
{
var
window = $(
"#window_newDataSheet"
).data(
"kendoWindow"
);
window.center().open();
}
},
error:
function
() {
$(
".validation-summary-valid"
).text(result.message);
}
});
}