How to sync a datasource?

5 posts, 0 answers
  1. Andrew
    Andrew avatar
    29 posts
    Member since:
    Sep 2010

    Posted 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!




  2. Andrew
    Andrew avatar
    29 posts
    Member since:
    Sep 2010

    Posted 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" }
    ], 

    ...
  3. Kendo UI is VS 2017 Ready
  4. Andrew
    Andrew avatar
    29 posts
    Member since:
    Sep 2010

    Posted 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...
  5. Jonas
    Jonas avatar
    33 posts
    Member since:
    Sep 2009

    Posted 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?
  6. Lito
    Lito avatar
    1 posts
    Member since:
    Nov 2013

    Posted 14 Nov 2013 Link to this post

    Hi,

    My Grid sync with my MySQL datasource for read and update. But I cannot sync for Delete (destroy) and Add.
    I am sure what the db connection code should look like. Could you please share me your

    url: "services/user-delete.php",
    and 
      url: "services/user-add.php", 

    I was expecting that there will be a DROP query in delete.php and and INSERT query in the add.php. Is that correct?

    My Grid looks like this:

    arrowscorenow.com/asn_batch/select_archers.php

    The Grid itself seems to work but the MYSQL DB does not sync for delete and add.

    Thanks.
Back to Top
Kendo UI is VS 2017 Ready