This is a migrated thread and some comments may be shown as answers.

Problem with Pop Up Edit

5 Answers 295 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rohit
Top achievements
Rank 1
Rohit asked on 05 Apr 2012, 06:45 PM
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");
                        }
                    });

                }
            });

 

5 Answers, 1 is accepted

Sort by
0
Luke
Top achievements
Rank 1
answered on 03 May 2012, 03:08 PM
I have the same problem with "inline" and "popup", but "true" (cell level editing) works fine.
0
David
Top achievements
Rank 2
answered on 06 May 2012, 12:42 PM
I am also having problems with the popup editor, based on the GitHub asp.net project, I get g is undefined error
0
Alexander Valchev
Telerik team
answered on 08 May 2012, 03:07 PM
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!
0
David
Top achievements
Rank 2
answered on 15 May 2012, 02:39 PM
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...
0
Alexander Valchev
Telerik team
answered on 16 May 2012, 09:14 AM
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!
Tags
Grid
Asked by
Rohit
Top achievements
Rank 1
Answers by
Luke
Top achievements
Rank 1
David
Top achievements
Rank 2
Alexander Valchev
Telerik team
Share this question
or