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

How to create data model for Odata web services to enable CRUD operarions in grid

21 Answers 529 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Marko
Top achievements
Rank 1
Marko asked on 20 Jan 2012, 05:04 PM
Hi,

I found this documentation for information to create KendoUI grid with CRUD operations. It seems that there is Product model behind this. But I did not find any information or examples about how to create kendo.data.model for remote data (Odata service).  Could anyone help with this?

read:   "/Products",
         update: {
            url: "/Products/Update",
            type: "POST"
         },
         destroy: {
             url: "/Products/Destroy",
             type: "POST"
          },
          create: {
              url: "/Products/Create",
              type: "POST"
           }

BR
Marko

21 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 23 Jan 2012, 09:09 AM
Hello Marko,

Currently CRUD operations with OData is not supported. We are working on solution that will allow CRUD operations with OData services.

All the best,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Marko
Top achievements
Rank 1
answered on 23 Jan 2012, 11:03 PM
Hi,

Nice to hear that. What is expected time frame for this Odata CRUD support?

How CRUD operations to remote data is implemented in this demo case, is there web service behind?

 
BR
Marko
0
Accepted
Nikolay Rusev
Telerik team
answered on 25 Jan 2012, 09:45 AM
Hello Marko,

You can find sample app implemented on the link bellow:
https://github.com/telerik/kendo-examples-asp-net

Greetings,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Elan
Top achievements
Rank 1
answered on 17 Mar 2012, 10:20 AM
Any updates on when OData CRUD will be available?
0
Atanas Korchev
Telerik team
answered on 19 Mar 2012, 08:24 AM
Hello,

 OData CRUD will be supported in the next official release - Q1 2011.

Regards,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Elan
Top achievements
Rank 1
answered on 19 Mar 2012, 10:52 AM
Atanas,

Do you mean Q1 2012?
0
Atanas Korchev
Telerik team
answered on 19 Mar 2012, 12:30 PM
Hi,

 Of course. I meant Q1 2012. It seems I am still living in the past :)

Regards,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Elan
Top achievements
Rank 1
answered on 19 Mar 2012, 12:49 PM
Can you confirm that  this functionality available in the beta?

From what I can tell, it is not. :(
0
Atanas Korchev
Telerik team
answered on 19 Mar 2012, 01:20 PM
Hi,

 No it is not supported in the beta.

Regards,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Ryan Lege
Top achievements
Rank 1
answered on 10 Sep 2012, 01:05 PM
What is the latest on this? I have Q2 installed and I have seen no documentation on how to implement ODATA CUD.
0
Atanas Korchev
Telerik team
answered on 10 Sep 2012, 01:43 PM
Hello,

 OData CRUD is now supported. There is a demo project here: https://github.com/telerik/kendo-examples-asp-net/tree/master/grid-odata-crud 

Regards,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Ryan Lege
Top achievements
Rank 1
answered on 12 Sep 2012, 07:05 PM
I cannot for the life of me get the CUD to work, only the Read. No transaction takes place against the DB through ODATA. I followed the example exactly.
0
Atanas Korchev
Telerik team
answered on 13 Sep 2012, 06:04 AM
Hello,

 We can't really help without seeing some code.

All the best,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Ryan Lege
Top achievements
Rank 1
answered on 13 Sep 2012, 06:35 AM


<div id="example" class="k-content">
    <div id="gridPaxEdit"></div>
    <script>
        $(document).ready(function () {
            var crudServiceBaseUrl = DataService + "/EventPaxBreakDowns",
                
            dataSource = new kendo.data.DataSource({
                type: "odata",
                transport: {
                    read: {
                        url: crudServiceBaseUrl,
                        dataType: "jsonp",
                        data: {                  
                            $expand: "Country"
                        }
                    },
                    update: {
                        url: function (data) {
                            return crudServiceBaseUrl + "(" + data.PaxBDID + ")";
                        }
                    },
                    create: {
                        url: crudServiceBaseUrl
                    },
                    destroy: {
                        url: function (data) {
                            return crudServiceBaseUrl + "(" + data.PaxBDID + ")";
                        }
                    }


                },
                filter: { filters: [{ field: "EventID", operator: "eq", value: parseInt($("#EventId").val()) }]},
                serverPaging: true,
                batch: false,


                schema: {
                    model: {
                        id: "PaxBDID",
                        fields: {
                            PaxBDID: { editable: false, nullable: true },
                            EventID: { type: "number" },
                            
                            MilitaryPlanned: { type: "number" },
                            MilitaryActual: { type: "number" },
                            CivilianPlanned: { type: "number" },
                            CivilianActual: { type: "number" },
                            Country: {}
                        }
                    }
                        
                }
            });


            $("#gridPaxEdit").kendoGrid({
                dataSource: dataSource,
                height: 250,
                pageable: true,
                toolbar: ["create"],
                columns: [
                    {
                        field: "Country",
                        template: "#=Country.Title#",
                        editor: PaxCountryDropDown
                    }, {
                        field: "MilitaryPlanned",
                        title: "Military Planned"


                    }, {
                        field: "MilitaryActual",
                        title: "Military Actual"


                    }, {
                        field: "CivilianPlanned",
                        title: "Civilian Planned"
                    }, {
                        field: "CivilianActual",
                        title: "Civilian Actual"
                    },
                    { command: ["edit", "destroy"], title: "&nbsp;", width: "210px" }
                ]


                ,
                editable: "inline"


            });


            function PaxCountryDropDown(container, options) {
                $('<input data-text-field="Title" data-value-field="CountryID"/>')
                .appendTo(container)
                .kendoComboBox({
                    dataType: 'json',
                    dataTextField: "Title",
                    dataValueField: "CountryID",
                    autoBind: false,
                    minLength: "1",
                    suggest: true,
                    highLightFirst: true,
                    filter: "startswith",
                    dataSource: {
                        transport: {
                            read: "/_LoadCountryData"
                        },
                        serverFiltering: true
                    }
                });
            }
        });          
    </script>
</div>


Side note: I really would like to to Load On demand through ODATA with the Combobox I have as well.
0
Atanas Korchev
Telerik team
answered on 13 Sep 2012, 07:14 AM
Hi Benjamin,

 What exactly happens when say an update operation is executed? Do you see any JavaScript errors in your browser development tools console? Did you check what the response of the HTTP request is? 

 On a side note make sure your page and OData service are in the same domain. Cross-domain OData requests will not work because you cannot perform OData CUD via JSONP.

Regards,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Ryan Lege
Top achievements
Rank 1
answered on 13 Sep 2012, 07:30 AM
Fiddler reports the initial read, but after that if one tries to edit or delete or even create nothing happens. The Grid delete and edit respond but visually but nothing is actually transacting, and fiddler shows no activity. The Add button does not even respond. I should tell you that this grid is sitting inside a Kendo Window that is opened when the end user clicks a button on the main page. Also it is in the same Domain 
0
Atanas Korchev
Telerik team
answered on 13 Sep 2012, 08:13 AM
Hello,

I am out of ideas. Does the github project work as expected at your side? Could you modify it so it mimics your own scenario which does not work?

All the best,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Ryan Lege
Top achievements
Rank 1
answered on 13 Sep 2012, 08:18 AM
I am attempting to run a test project with the identical GIT example. In the meantime, are you sure that rendering the grid in a KendoWindow is not hindering it from making a ODATA CRUD call?


///FINAL UPDATE

The github example is not doing CUD at all. It is behaving the same as my project. Any ideas folks??
0
Ryan Lege
Top achievements
Rank 1
answered on 13 Sep 2012, 12:13 PM
A CLUE DISCOVERED: Having debugged the github example with fiddler, it seems then when reading the data the the "JSONPSupportBehavior" is getting applied correctly. When attempting Delete Create or Update fiddler is showing a error of :
"A supported MIME type could not be found that matches the content type of the response. None of the supported type(s) 'application/atom+xml;type=entry, application/atom+xml, application/json;odata=verbose' matches the content type 'application/json'."

I was under the impression that JSONPSupportBehavior was supposed to take care of this both directions?
0
Ryan Lege
Top achievements
Rank 1
answered on 14 Sep 2012, 09:41 AM
What is the latest on this? I really would like to see this resolved. Thanks
0
Nikolay Rusev
Telerik team
answered on 17 Sep 2012, 03:04 PM
Hello Benjamin,

I am afraid that we are not able to determine what is wrong with your project. Kendo DataSource supports only JSON for response when binding to OData.

I am attaching the project from the GitHub library. Seems to be perfectly execute all CRUD operations on our end.

Regards,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Data Source
Asked by
Marko
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Marko
Top achievements
Rank 1
Elan
Top achievements
Rank 1
Atanas Korchev
Telerik team
Ryan Lege
Top achievements
Rank 1
Share this question
or