jQWidgets Forums

jQuery UI Widgets Forums TreeGrid XML structure for Treegrid

This topic contains 1 reply, has 2 voices, and was last updated by  Dimitar 9 years, 9 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • XML structure for Treegrid #74568

    markzolotoy
    Participant

    I see that an xml for the control is basically an element based xml. Can I use an attribute based xml?

    Thanks

    XML structure for Treegrid #74592

    Dimitar
    Participant

    Hello markzolotoy,

    Yes, you can load data from XML attributes, too. You just need to map your datafields correctly. Here is an example:

    customers.xml:

    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <Customers>
    <Customer CustomerID="1" Name="Customer 1"></Customer>
    <Customer CustomerID="2" Name="Customer 2"></Customer>
    </Customers>

    JavaScript:

    var url = "../sampledata/customers.xml";
    
    var source = {
        dataType: "xml",
        dataFields: [{
            name: 'CustomerID',
            map: '[CustomerID]'
        }, {
            name: 'Name',
            map: '[Name]'
        }],
        root: "Customers",
        record: "Customer",
        url: url
    };
    var dataAdapter = new $.jqx.dataAdapter(source);

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.