Hi Admin and everybody,
I am working with dataSource for Image Editor.
I completed get data and give it for Kendo Image Editor.
But, I cannot use it with "autoBind: false" to stop load when start page like Title or call it with .read().
This is my code:var dataSourceGetImageUrl = new kendo.data.DataSource({
transport: {
read: function (options) {
$.ajax({
url: "/_layouts/15/xxx/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"
}
}
});
dataSourceGetImageUrl.fetch(function () {
var dataSource = dataSourceGetImageUrl;
var view = dataSourceGetImageUrl.view()[0].imageUrl;
$("#imageEditor").kendoImageEditor({
autoBind: false, //It not working.It still read when my page start
dataSource: dataSource,
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 });
});
});
I tried call .read() with code. But it not working
$("#imageEditor").data("kendoImageEditor").dataSource.read();
//OR
dataSourceGetImageUrl.read(); // All both not working. I cannot call .read() to reload
dataSourceGetImageUrl