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

How to save the contents of a grid to the database

1 Answer 331 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Johan
Top achievements
Rank 1
Johan asked on 19 May 2013, 07:48 PM
This may be trivial but I tried many ways and just cannot get it right. I have 2 situations where I populate a grid: 
1. I filled the grid from the contents of a table similar to one of the demos.
2. I populate a grid by starting from an empty grid which I populate with data including cells which has an autocomplete editor as well.

I tried different variations of the CRUD example but it seems that if you do not have a read statement in transport the update do not work.

I want to save the contents of the whole grid to a mysql database by using php. Is there an example that I missed or how can this be done?

1 Answer, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 22 May 2013, 06:46 AM
Hi Johan,

There are several ways to do that and which one you will choose depends entirely on you and the exact setup that you have. To submit all changes at once to the server I would suggest to define Read / Update actions and make the server to always return empty array of data from the Read action. Then define the Grid edit mode to "incell" and set the "batch" option to true:

  • Set the editable option of the Grid:
    ->editable('incell')
  • Set the "batch" option to true:  
    $dataSource->transport($transport)
           ->batch(true)  

Using the above setup when the user press "SaveChanges" button all created records will be sent to the server with one request. 

Kind Regards,
Vladimir Iliev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Johan
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Share this question
or