:: Home >>

columns

Specifies the XPath expression for the table columns (cells).

The default columns XPath is "*" - selecting all child nodes under the row node. Use setColumns(xpath) or setColumns([xp1, xp2 ...]) to specify different location or subset of the cell nodes. It is possible to use expressions for the attributes ("@name"), elements ("name") or any other valid xpath. The xpath is evaluated relative to the row node.

Syntax

var value = obj.getColumns(); 
obj.setColumns(value);        

Examples

The following example displays column data using child elements, row attribute (@id) and child node attribute (price/@ccy).

<xml id="data">
    <orders>
        <order id="101">
            <product>RedWidget</product>
            <price ccy="USD">456.00</price>
            <qty>10</qty>
        </order>
        <order id="102">
            <product>BlueWidget</product>
            <price ccy="GBP">123.00</price>
            <qty>1</qty>
        </order>
    </orders>
</xml>

<script>

    var table = new AW.XML.Table;
    table.setColumns(["@id", "product", "price", "price/@ccy", "qty"]);
    table.setXML(document.getElementById("data"));

    var obj = new AW.UI.Grid;
    obj.setCellModel(table);
    obj.setColumnCount(5);
    obj.setRowCount(2);
    document.write(obj);

</script>

See also

Set table, rows XPath, namespace property

Comments

17 Apr 07
xml tag has uppercase letter is not working in FF2.0 Jarlau (1)

Comments will appear on this page and in the main forum.

Documentation:

Recent changes:

2.5.0 - 2.5.2
2.5.2
2.5, 2.5.1
2.5.1
2.5
Release History
2.5
2.0.2
textToValue
textToData