I don't know what happend with my Kendo Image Editor. It add more Kendo Image Editor to Kendo Window.
I only transmit one link from the data source.
My Json in data source only has 1 link, but when I open kendo window, it crashes.
When it call dataSourceGetImageUrl.read(); it will add new one more kendo Editor
Info in my image: https://ibb.co/hcx2ck7
My code:
var dataSourceGetImageUrl = new kendo.data.DataSource({
transport: {
read: function (options) {
$.ajax({
url: "/_layouts/15/VuThao.TrainSharepoint/API/ApiHandler.ashx?tbl=like&func=getimageurl",
type: 'GET',
cache: false,
scriptCharset: "utf8",
dataType: "json",
data: {
models: kendo.stringify(options.data.models)
},
success: function (result) {
options.success(result);
}
});
},
},
schema: {
data: 'data',
model: {
id: "imageUrl"
}
},
change: function (e) {
var view = dataSourceGetImageUrl.view()[0].imageUrl;
$("#imageEditor").kendoImageEditor({
imageUrl: view,
width: "100%",
height: 650,
saveAs: {
fileName: "image_edited.png"
}
});
var imageEditor = $("#imageEditor").getKendoImageEditor();
imageEditor.one("imageRendered", function () {
imageEditor.executeCommand({ command: "ZoomImageEditorCommand", options: imageEditor.getZoomLevel() - 0.2 });
});
}
});
Every time execute:
dataSourceGetImageUrl.read(); //it will add kendo image editor one more time
I solved my problem. It worked when I add more something