views:

69

answers:

0

I have the following XML-File:

<filter>
        <rule>
                <name>User1</name>
                <mail>
                        <address>[email protected]</address>
                        <address>[email protected]</address>
                        <address>[email protected]</address>
                </mail>
        </rule>
        <rule>
                ....
        </rule>
</filter>

I want to use dojox.grid.DataGrid and dojox.data.XmlStore to show following table:

+---------------+-------------+
+ User1         | [email protected] |
+               | [email protected]    |
+               | [email protected]  |
+---------------+-------------+
+ User2         | ...         |

How can i do this?

This source shows onlay the name:

    <script type="text/javascript">
        dojo.require("dojox.grid.DataGrid");
        dojo.require("dojox.data.XmlStore");

        dojo.addOnLoad(function() {
            var store4 = new dojox.data.XmlStore({
                url: 'file.xml',
                rootItem: 'rule',
            });

            // set the layout structure:
            var layout4 = [{
                field: 'name',
                name: 'Name',
                width: '200px'
            }, {
                field: 'mail.address',
                name: 'Mail-Address',
                width: '200px'
            }];

            // create a new grid:
            var grid4 = new dojox.grid.DataGrid({
                query: {
                    name: '*'
                },
                store: store4,
                clientSort: true,
                rowSelector: '20px',
                structure: layout4
            },
            document.createElement('div'));

            // append the new grid to the div "gridContainer4":
            dojo.byId("gridContainer4").appendChild(grid4.domNode);

            // Call startup, in order to render the grid:
            grid4.startup();
        });
    </script>

    <script type="text/javascript">
        dojo.addOnLoad(function() {
            if (document.pub) {
                document.pub();
            }
        });
    </script>