Premium forums

How to sync a datasource?

  • Andrew
    Andrew avatar

    04 Jan 2012 (Link to this post)

    I have created a simple test to display a MySQL data table on a Kendo Grid using the DEMOS example as a template (ie, using a toolbar with Add/Edit/Cancel buttons, and having a Destroy command button in the grid).   I have defined my transport as:

    transport: {
     read: {
                    url: "services/user-read.php", 
                    dataType: "JSON"
                  },
                  create: {
                    url: "services/user-add.php", 
                    type: "POST"
                  },
                  update: {
                    url: "services/user-edit.php",
                    type: "POST"
                  } ,
     destroy: {
                    url: "services/user-delete.php",
                    type: "POST"
                  }
    },


    During use, the Grid lets me Add / Edit and Delete records (and initially READS records just fine).   However, my Create/Update/Destroy PHP's never get called.   Is there something I have to manually do to get a Datasource to call these functions?   Any good examples of this available?

    Thanks in advance!




  • Andrew
    Andrew avatar

    04 Jan 2012 (Link to this post)

    Update.  Problem with most of it was an error in my PHP scripts.   READ / CREATE and UPDATE now fire properly.   

    DESTROY still does not and I am open to any ideas.  Grid is created with this part defining the buttons (same as DEMO sample), so not sure why it is not firing the destroy handler defined in the transport...

    ...
    toolbar: ["create", "save", "cancel"],
    columns:[
     { field: "user_name", title: "Username" },
     { field: "password", title: "Password" },
     { field: "display_name", title: "Display Name" },
     { command: "destroy", title: " ", width: "110px" }
    ], 

    ...
  • Andrew
    Andrew avatar

    04 Jan 2012 (Link to this post)

    Ok, figured out my own mess.   Delete event in Transport does not fire until a user also presses SAVE CHANGES - at which point the queued up deletes go one after another...
  • 23 Jan 2012 (Link to this post)

    Stumbled on this too, I dont think it's very intuitive to demand the user to click on "save" after "destroy" (and he already clicked confirm). Should be an option. Is it already?

Read FAQ or see Kendo UI in action!

Launch Demos