简体   繁体   中英

Kendo UI XML Datasource with Editable Grid

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 below.

            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...

Ish

I believe this should work:

model: {
    id: "NameSequence", 
    fields: {                           
        name: { field: "Name/text()", editable: true, validation: { required: true } },
        phoneNumber: { field: "PhoneNumber/text()", editable: true },
        email: { field: "Email/text()", editable: true },
        nameSequence: { field: "NameSequence/text()", editable: false }                         
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM