:: Documentation >>

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

AW.XML.Table function getColumns() doesn't appear to exist Anthony (1)
xml tag has uppercase letter is not working in FF2.0 Jarlau (1)

Documentation:

Recent changes:

2.6.4
2.6.3
2.6.2
2.6.1
2.6.1
2.6.0
2.5.0 - 2.5.6
2.5.6
2.5.0 - 2.5.5
2.5.5