Problem with Pop Up Edit

6 posts, 0 answers
  1. Rohit
    Rohit avatar
    3 posts
    Member since:
    Mar 2012

    Posted 05 Apr 2012 Link to this post

    So here is the problem.

    I have a grid which need to make an update through POST and not GET. SO I am doing this on Save event. Everything works fine with inline editing. But with PopUp editing I do not get referance to model. So in function " save: function (e)" below e.model is undefined. However it comes up fine in case of inline.

    If there is better way to update the drid through POST then I am open to it.

    here is the code:

     dataSource = new kendo.data.DataSource({
                    transport: {
                        read: {
                            url: URL,
                            dataType: "jsonp"
                        },
                        update: {
                            url: "",
                            dataType: "jsonp"
                        },
                        destroy: {
                            url: "",
                            dataType: "jsonp"
                        },
                        create: {
                            url: "",
                            dataType: "jsonp"
                        },
                        parameterMap: function (options, operation) {
                            if (operation !== "read" && options.models) {
                                return { models: kendo.stringify(options.models) };
                            }
                        }
                    },
                    batch: true,
                    pageSize: 10,
                    schema: {
                        model: {
                            id: "PROJECT_ID",
                            fields: {
                                "PROJECT_ID": { editable: false, nullable: true },
                                "PROJECT_NM": { validation: { required: true} },
                                "PROJECT_DESC": { validation: { required: true} },
                                "ACTIVE_IND": { type: "boolean" }
                            }
                        }
                    }

                });

     

    //GRID
    $("#grid").kendoGrid({
                    dataSource: dataSource,
                    pageable: true,
                    height: 400,
                    toolbar: ["create"],
                    columns: [
                                { field: "PROJECT_ID", title: "ID" },
                                { field: "PROJECT_NM", title: "Name" },
                                { field: "PROJECT_DESC", title: "Description" },
                                { field: "ACTIVE_IND", title: "Active" },
                                { command: ["edit"], title: " "}],
                    editable: "popup",
                    save: function (e) {

                        var g = $("#grid").data("kendoGrid");
                        var ds = g.dataSource;

                        var refresh = false;
                        //alert(kendo.stringify(e.model));
                        var url = "";
                        e.model.ACTIVE_IND = e.model.ACTIVE_IND ? 1 : 0
                             $.ajax({
                            url: url,
                            data: kendo.stringify(e.model),
                            type: 'POST',
                            processData: true,
                            async: false,
                            contentType: "application/json",
                            success: function (data, textStatus, jqXHR) {
                                        alert("Updated")  

                            },
                            error: function (xhr, status, error) {
                                alert("Failed to Update");
                            }
                        });

                    }
                });

     

  2. Luke
    Luke avatar
    6 posts
    Member since:
    Jul 2011

    Posted 03 May 2012 Link to this post

    I have the same problem with "inline" and "popup", but "true" (cell level editing) works fine.
  3. Kendo UI is VS 2017 Ready
  4. David
    David avatar
    10 posts
    Member since:
    Apr 2008

    Posted 06 May 2012 Link to this post

    I am also having problems with the popup editor, based on the GitHub asp.net project, I get g is undefined error
  5. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2877 posts

    Posted 08 May 2012 Link to this post

    Hello guys,

    I am glad to inform you that the bug connected with the missing model reference on the save event is already fixed and the fix is available in the latest internal build.

    @Rohin
    It is possible to set the type of the transport request through the configuration options - they are similar to the one of jQuery.ajax() method.
    transport: {
        read: {
            url: URL,
            dataType: "json",
            type: "POST"
        }
        //...
    }

    @David
    Could you please check what version of the framework is included in your project. The ASP.NET examples from our GitHub page use KendoUI v.2011.3.1129 which does not support popup editing mode. This functionality is available since the latest official release, so you will have to upgrade the scripts.

    All the best,
    Alexander Valchev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  6. David
    David avatar
    10 posts
    Member since:
    Apr 2008

    Posted 15 May 2012 Link to this post

    Alexander,

    I pulled the latest internal build (Kendo UI Web v2012.1.503), the problem is still occuring for me.

    g is undefined
    ...orpicker"><div class="k-widget k-colorpicker k-header #= cssClass #"><span class...
  7. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2877 posts

    Posted 16 May 2012 Link to this post

    Hello David,

    We are not aware of such problem and the information that you provided is not sufficient enough to determine what is causing the error.
    Is it possible to send me a small but runnable project that I could test in details? Please provide such example and I will check it right away.

    Regards,
    Alexander Valchev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top
Kendo UI is VS 2017 Ready