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

Grid with PHP. Problem with CRUD

1 Answer 149 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vauneen
Top achievements
Rank 1
Vauneen asked on 04 Mar 2012, 04:08 PM
Hi all,

i'm a bit stuck with the crud functionality in Kendo UI's grid.

My code (see below) generates a populated grid and the neccessary buttons, but i dont seem to be 'binding' the 'save' button to the 'save' functionality in the php file. Can anyone maybe spot what i'm missing please?

Thanks!
Vauneen

dataSource = new kendo.data.DataSource({
                    transport: {
                        read: "data/users.php",
                        create: {
                            url: "data/user_add.php",
                            type: "POST"
                        },
                        save: {
                            url: "data/user_edit.php",
                            type: "POST"
                        } ,
                        parameterMap: function(options, operation) {
                            if (operation !== "read" && options.models) {
                                return {models: kendo.stringify(options.models)};
                            }
                        }
                    },
                    schema: {
                        data: "data",
                        model: {
                            id: "ProductID",
                            fields: {
                                ExpiryDate : {  editable: true, type: "date"},
                                EmailAddress : {  editable: true, type: "email"},
                                FirstName : {  editable: true, type: "text"},
                                SecondName : {  editable: true, type: "text"}
                            }
                        }
                    }
                })
           
$("#grid").kendoGrid({
                dataSource: dataSource,
                columns: [{ field: "ID" }, { field: "ExpiryDate", title:"Expiry Date",  format: "{0:yyyy-MM-dd}" }, { field: "EmailAddress" }, { field: "FirstName" }, { field: "SecondName"    } ],
                editable: true,
                toolbar: ["create", "save", "cancel"],
                detailTemplate: kendo.template($("#template").html()),
                detailInit: detailInit
            });
           


1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 05 Mar 2012, 10:41 AM
Hello Vauneen,

Looking at the code you have pasted, it seems that the issue is caused by incorrect DataSource declaration. As you may know there is no "save" option for the transport as it is follows the Cread/Read/Update/Destroy naming. Please refer to our online demo and documentation for information.

Greetings,
Rosen
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
Vauneen
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or