Telerik Forums
Kendo UI for jQuery Forum
0 answers
186 views

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'm really tired, can anyone help me to solve it


Stark
Top achievements
Rank 1
Iron
Iron
 updated question on 14 May 2021
0 answers
110 views

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
Stark
Top achievements
Rank 1
Iron
Iron
 updated question on 13 May 2021
Narrow your results
Selected tags
Tags
+? more
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?