How to read imageUrl in Kendo ImageEditor with dataSource

0 Answers 148 Views
ImageEditor
Stark
Top achievements
Rank 1
Iron
Iron
Stark asked on 11 May 2021, 06:00 PM | edited on 12 May 2021, 04:40 PM

Hi Admins and everybody

I want to read imageUrl of Kendo ImageEditor using dataSource + TRANSPORT WITH FUNCTION

But It don't show. What wrong with my code. I have to image show json data in url

My code:


var dataSourceGetImageUrl = new kendo.data.DataSource({
        transport: {
            read: function (options) {
                $.ajax({
                    url: "/api/handler.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'
        }
    });
   
    $("#imageEditor").kendoImageEditor({
        dataSource: dataSourceGetImageUrl,
        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 });
    });

What I need to fix it? Hope Admin and eeverybody help me. Thanks.

Stark
Top achievements
Rank 1
Iron
Iron
commented on 12 May 2021, 05:21 PM

I solved my problem, I don't have method fetch(). it worked when I add more .fetch()

No answers yet. Maybe you can help?

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