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

CRUD with custom functions

6 Answers 606 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
IT
Top achievements
Rank 1
IT asked on 25 Apr 2012, 02:21 PM
Hello,

We have a back end database that we interact with using a custom library. All the CRUD is in the form of GET / POST / PUT calls to our back end. The following is what we use to interact with our database:
db.get('some-record', function(resp) { });

db.put('some-record', { hello: 'world' }, function(resp) { });

db.post({ hello: 'world' }, function(resp) { });

db.destroy('some-record', { rev: 'abcdef123456789' }, function(resp) { });
The resp variable is a JSON object. Given the above, I have been able to successfully perform all CRUD operations on our database. Now, I would like to implement a Kendo GRID with Popup Editing as here: http://demos.kendoui.com/web/grid/editing-popup.html

How do I define the update, destroy and create functions using the functions above that interact with my database?

The part I do not understand is how the 'transport' works for updating in the demo code at the above link:

dataSource = new kendo.data.DataSource({
                            transport: {
                                read:  {
                                    url: crudServiceBaseUrl + "/Products",
                                    dataType: "jsonp"
                                },
                                update: {
                                    url: crudServiceBaseUrl + "/Products/Update",
                                    dataType: "jsonp"
                                },
                                destroy: {
                                    url: crudServiceBaseUrl + "/Products/Destroy",
                                    dataType: "jsonp"
                                },
                                create: {
                                    url: crudServiceBaseUrl + "/Products/Create",
                                    dataType: "jsonp"
                                },
                                parameterMap: function(options, operation) {
                                    if (operation !== "read" && options.models) {
                                        return {models: kendo.stringify(options.models)};
                                    }
                                }
                            }



6 Answers, 1 is accepted

Sort by
0
Ä m o l
Top achievements
Rank 2
answered on 25 Apr 2012, 04:26 PM
I am using MVC APIController with CRUD operation but the Kendo UI Grid  is not working for Type: PUT,DELETE...
 
0
IT
Top achievements
Rank 1
answered on 25 Apr 2012, 04:36 PM
Thank you for your reply Amol, can you please explain further or show a code sample?

Where is the MVC API controller?
0
Ä m o l
Top achievements
Rank 2
answered on 26 Apr 2012, 05:00 AM
0
Lee
Top achievements
Rank 1
answered on 30 Apr 2012, 04:01 PM
I am in the same boat.  I have a fully functioning application but cannot get it to work with the transport CRUD operations.  I cannot find a full example anywhere..
0
Ä m o l
Top achievements
Rank 2
answered on 07 May 2012, 05:15 AM
Hey Lee
let me know which technology are you using... so that I will put the complete example of CRUD operation let me know your email ID so that I will attache example...
0
Lee
Top achievements
Rank 1
answered on 08 May 2012, 11:28 AM
Thanks Amol, you are very kind.  I am using PHP.  I have an example of what I am trying to do in the following forum post:

Getting started with datasource CRUD
Tags
Data Source
Asked by
IT
Top achievements
Rank 1
Answers by
Ä m o l
Top achievements
Rank 2
IT
Top achievements
Rank 1
Lee
Top achievements
Rank 1
Share this question
or