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

Grid with popup editing + PHP

1 Answer 95 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Fedon
Top achievements
Rank 1
Fedon asked on 27 Aug 2012, 07:20 PM
Hello,
I am following the examples linking the grid with a database through php found here.
Also, following the example of grid with popup editing found here.
I am trying to combine these examples so i can edit a grid linked with a database through php using popup editing, without a success.

First approach - keeping the different end points for the dataSource as in the popup editing example.

<div id="order_example" class="k-content">
    <div id="grid"></div>
     
    <script>
        $(document).ready(function () {
            $("#grid").kendoGrid({
                dataSource: {
                    transport: {
                        read: {
                          url: "order.php"
                        },
                        update: {
                          url: "order_update.php"
                        },
                        parameterMap: function(options, operation) {
                          if (operation !== "read" && options.models) {
                            return {models: kendo.stringify(options.models)};
                          }
                        }
                    },
                    schema: {
                        data: "data",
                        model: {
                          id: "_id",
                          fields: {
                            description: {validation: {required: true} }
                          }
                        }
                    }
                    //pageSize: 10
                },
                batch: true,
                columns: [
                           {title: "ID", field: "_id"},
                           {title: "Description", field: "description"},
                           {command: "edit"}
                ],
                height: 450,
                navigatable: true,
                editable: "popup"
            });
        });
     
        </script>
  </div>

Second approach - keeping the whole functionality in one php file as in the first example...
Code changed is in dataSource: 
transport: {
      read: {
        url: "order.php"
      },
      update: {
        url: "order.php",
        type: "POST"
      }
},

In both approaches the following happen:

  • With jquery 1.7.1, when i click the edit button it just disappears!! It reappears though, when i click another one, so the last one disappears...

  • With jquery 1.8.0 i get the following error in the console...
Uncaught Error: Syntax error, unrecognized expression: tr:not(.k-grouping-row) > td:not(.k-hierarchy-cell,.k-detail-cell,.k-group-cell,.k-edit-cell,:has(a.k-grid-delete)) jquery-1.8.0.min.js:2
Z.error jquery-1.8.0.min.js:2
bg jquery-1.8.0.min.js:2
Z.compile jquery-1.8.0.min.js:2
bm jquery-1.8.0.min.js:2
h.querySelectorAll.bm jquery-1.8.0.min.js:2
Z jquery-1.8.0.min.js:2
h.querySelectorAll.Z.matchesSelector jquery-1.8.0.min.js:2
p.extend.filter jquery-1.8.0.min.js:2
p.fn.extend.is jquery-1.8.0.min.js:2
p.event.dispatch jquery-1.8.0.min.js:2
p.event.add.g.handle.h jquery-1.8.0.min.js:2

Any ideas? Has anyone tried to do the same thing? Please any help is appreciated!! 

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 30 Aug 2012, 01:56 PM
Hello Fedonman,

Your Kendo code looks OK except from the fact that batch configuration should be part of the dataSource object.

Generally speaking there is no matter whether you use the same url for read and update as long as you are able to distinguish on the server which action is called. I assume that the problem is connected with the dataSource model configuration. Could you please try to define the type of all fields that persist in your dataSource, not just the one that need a validation?
In case this does not help, it would be best if you could provide a jsFiddle or other runnable example that demonstrates edit button disappearing issue. Thus way I would be able to investigate what is going wrong and advise you further.

Regarding the jQuery version, the official release (2012.2.710) is not compatible with jQuery 1.8.0. The latter jQuery version is supported in the internal builds (2012.2.814+) which are available for commercial licence owners.

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
Fedon
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or