Kendo Image Editor Error in Kendo Window. Please help me.

0 Answers 185 Views
Data Source ImageEditor
Stark
Top achievements
Rank 1
Iron
Iron
Stark asked on 14 May 2021, 04:14 AM | edited on 14 May 2021, 05:28 AM

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
commented on 14 May 2021, 09:03 AM

I solved my problem. It worked when I add more something

No answers yet. Maybe you can help?

Tags
Data Source ImageEditor
Asked by
Stark
Top achievements
Rank 1
Iron
Iron
Share this question
or