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

Editable Grid with XML Datasource

2 Answers 121 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
mahi
Top achievements
Rank 1
mahi asked on 07 Jun 2014, 05:23 PM
I am trying use KendoUI javascript library to implement a web dashboard. I have implemented the view functions by getting data from a XML web service and it all works well. But got stuck when I try to introduce edit features.My KendoGrid's datasource schema is as 

schema: {
                type: "xml",
                data: "/xmlResponse/Contacts/Contact",
                model: {
                    id: "NameSequence",
                    fields: {                          
                        name: "Name/text()",
                        phoneNumber: "PhoneNumber/text()",
                        email: "Email/text()",
                        nameSequence: "NameSequence/text()"                        
                    }
                }  
            }



Since i have to map the XML tags to fields in the model fields, how should I specify parameters like editable, nullable or validations. Documentation doesn't provide any help on this. Samples are like below but they only talk about json transports.

schema: {
           model: {
                     id: "ProductID",
                     fields: {
                              ProductID: { editable: false, nullable: true },
                              ProductName: { validation: { required: true } },
                              UnitPrice: { type: "number", validation: { required: true, min: 1} },
                              Discontinued: { type: "boolean" },
                              UnitsInStock: { type: "number", validation: { min: 0, required: true } }
                    }
           }


I want to combine the both worlds and don;t have a clue on how to do that.

Any help would be great...


2 Answers, 1 is accepted

Sort by
0
mahi
Top achievements
Rank 1
answered on 09 Jun 2014, 11:56 PM
Isn't this possible to do? 
0
Vladimir Iliev
Telerik team
answered on 11 Jun 2014, 07:25 AM
Hi,

Please check the example below how to define additional options for the required fields:
model: {
    // configure the fields of the object
    fields: {
        // the "title" field is mapped to the text of the "title" XML element
        title: {field: "title/text()", editable: false},

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
Data Source
Asked by
mahi
Top achievements
Rank 1
Answers by
mahi
Top achievements
Rank 1
Vladimir Iliev
Telerik team
Share this question
or