How to "new kendo.data.DataSource" can use "autoBind: false". And can call .read()
0 Answers 11 Views
Stark
Top achievements
Rank 1
Iron
Iron
Stark asked on 13 May 2021, 09:16 AM | edited on 13 May 2021, 12:18 PM

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

Hope to get help soon from everyone. Thanks
After some more research, I solved the problem. Thanks guys so much
- by
Stark
Top achievements
Rank 1
Iron
Iron
on 13 May 2021, 02:07 PM
If it is not private information, would you mind taking the opportunity to add an Answer to this thread so that it will help future developers who have the same issue? Thank you!
- by
Lance | Manager Technical Support
Telerik team
on 17 May 2021, 01:56 PM

No answers yet. Maybe you can help?

Asked by
Stark
Top achievements
Rank 1
Iron
Iron
Share this question
or