ich die JS ein bisschen Datei und jetzt zumindest modifiziert Der Fehler wird nicht ausgelöst.
Werfen Sie einen Blick:
$("#open1").click(function() {
$("#win1").show().kendoWindow({
width: "500px",
height: "500px",
modal: true,
title: "Window 1"
});
});
//debugger;
$("#open2").click(function() {
$("#win2").show().kendoWindow({
width: "500px",
height: "500px",
modal: true,
title: "Window 2"
}).data("kendoWindow").center();
});
$("#close2").click(function() {
$("#win2").data("kendoWindow").close();
});
$(document).ready(function() {
$('.pai-del-menu').hide();
var cnt = 0;
var grid = $("#grid").kendoGrid({
dataSource: {
data: [{
FileName: '1 Download CSV (via btoa)',
ThreeDots: 'ThreeDots1'
}, {
FileName: '2 Download CSV (via btoa)',
ThreeDots: 'ThreeDots2'
}, {
FileName: '3 Download CSV (via btoa)',
ThreeDots: 'ThreeDots3'
}, {
FileName: '4 Download CSV (via btoa)',
ThreeDots: 'ThreeDots4'
}, {
FileName: '5 Download CSV (via btoa)',
ThreeDots: 'ThreeDots4'
}],
schema: {
model: {
fields: {
FileName: {
type: "string"
},
ThreeDots: {
type: "string"
}
}
}
},
sort: {
field: "FileName",
dir: "asc"
},
pageSize: 10
},
height: 500,
scrollable: true,
sortable: true,
selectable: true,
filterable: true,
pageable: true,
columns: [{
field: "FileName",
title: "File Name",
//template: "<a id=\"sportsDataPlayer\" download=\"download.csv\" type=\"text\/csv\">#= FileName.substring(FileName.lastIndexOf('/')+1) #</a>"
template: function csvDownload() {
//return "testing" + that.FinancialDocuments.ImageType(model);
var htmlString = "<a id=\'sportsDataPlayer\' download=\'download.csv\' type=\'text\/csv\'>#= FileName.substring(FileName.lastIndexOf('/')+1) #</a>"
var csv = "a,b,c\n1,2,3\n";
var data = new Blob([csv]);
var a2 = document.getElementById("sportsDataPlayer");
alert("I am here");
a2.href = URL.createObjectURL(data);
},
field: "ThreeDots",
title: "Last Name",
template: "<span class='deleteRow'>ThreeDots</span>"
}]
}).data("kendoGrid");
//var csv = "a,b,c\n1,2,3\n";
//var data = new Blob([csv]);
//debugger;
//var a2 = document.getElementById("sportsDataPlayer");
//alert("I am here");
//a2.href = URL.createObjectURL(data);
// grid.tbody.parents(".k-grid-content").eq(0).kendoScroller({ useOnDesktop: false });
// Start by hiding the confirmation
$('.testingConfirmation').hide();
// Create a persistent value for the window
var testingWindowVal;
// Listen to save button click
$("#save").click(function() {
// Set the persistent value
testingWindowVal = $("#fname").val();
// Show the dialog
if (testingWindowVal) {
$('.testingConfirmation').show();
}
});
// Listen to yes from the confirmation
$('#deleteDocumentYes').click(function() {
// Update necessary things
grid.dataSource.add({
"FileName": testingWindowVal,
"ThreeDots": "Last Name"
});
$("#fname").val('');
// Remove the value
testingWindowVal = null;
// Hide the dialog
$('.testingConfirmation').hide();
});
// Listen to no from the confirmation
$('#deleteDocumentNo').click(function() {
// Remove the value
testingWindowVal = null;
// Reset the #fname
$("#fname").val('');
// Hide the dialog
$('.testingConfirmation').hide();
});
});
Dies ist die aktualisierte Geige: http://jsfiddle.net/2s79mnq5/#&togetherjs=CVveJp1NKp
An einem ersten sehe ich einige Fehler sehen können, das Objekt, das Sie versuchen, das passieren, wie die Vorlage schlecht formatiert und nicht gültig. – halbano
Wenn Sie versuchen, das Element nach ID zu erhalten, ist das Element nicht im DOM, es würde nicht funktionieren, wie Sie denken. – halbano
@halbano hey, aber ich sehe nicht den Link im Grid ... Ich meine diesen Wert '1 Download CSV ... wenn Sie auf den ersten Fenster Link klicken ----------> jsfiddle.net/wL4v15vd/2 –