Note that there are some explanatory texts on larger screens.

plurals
  1. POKendo UI Grid - Update not persisting
    primarykey
    data
    text
    <p>Been trying to do an update on a Kendo grid and I'm having issues.</p> <p>I'm using Rails as the back-end and when I do the update, the server seems to be showing that everything worked:</p> <pre><code> Started PUT "/" for 127.0.0.1 at 2012-02-12 17:28:19 -0600 Processing by HomeController#index as Parameters: {"models"=&gt;"[{\"created_at\":\"2012-02-08T17:34:50Z\", \"first_name\":\"Milla\",\"id\":2,\"last_name\":\"sfasfsdf\",\"password\":\"\", \"updated_at\":\"2012-02-08T17:34:50Z\",\"user_name\" :\"\"}]"} Rendered home/index.html.erb within layouts/application (3.0ms) Completed 200 OK in 89ms (Views: 88.0ms | ActiveRecord: 0.0ms) </code></pre> <p>However, when I refresh the view, nothing has changed. When I checked the database, of course no changes had taken place there either.</p> <p>I went through the documentation here about how to do edits in the grid: <a href="http://demos.kendoui.com/web/grid/editing.html" rel="nofollow">http://demos.kendoui.com/web/grid/editing.html</a></p> <p>And I watched Burke Hollands video about how to set up the grid to work with Rails: <a href="http://www.youtube.com/watch?v=FhHMOjN0Bjc&amp;context=C3f358ceADOEgsToPDskKlwC22A9IkOjYnQhYyY9HI" rel="nofollow">http://www.youtube.com/watch?v=FhHMOjN0Bjc&amp;context=C3f358ceADOEgsToPDskKlwC22A9IkOjYnQhYyY9HI</a></p> <p>There must be something that I haven't done right, but I'm just not seeing it.</p> <p>Here's my code that works with the Kendo stuff:</p> <pre><code> var User = kendo.data.Model.define({ id: "id", fields: { first_name: { validation: { required: true } }, last_name: { validation: { required: true } } } }); var UsersData = new kendo.data.DataSource({ transport: { read: { url: "/users.json" }, create: { url: "/users/create.json", type: "POST" }, update: { type: "PUT" }, destroy: { type: "DELETE" }, parameterMap: function(options, operation) { if (operation !== "read" &amp;&amp; options.models) { return {models: kendo.stringify(options.models)}; } } }, batch: true, pageSize: 5, schema: { model: User } }); $("#users-grid").kendoGrid({ dataSource: UsersData, navigatable: true, editable: true, selectable: true, pageable: true, sortable: true, toolbar: ["create", "save", "cancel"], columns: [ { field: "first_name", title: "First Name" }, { field: "last_name", title: "Last Name" }, ] }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload