:: Forum >> Version 2 >>

checkbox in gird with xml island can't work!

with this thread:
/javascript.forum.9440.5/checkbox-example.html
The example is work well.
But If I use a xml island to the gird,It can't work!
The following is my code:

<body>
    <
xml id="xmlDataIsland">
        <
companies>
            <
company>
                <
ticker>MSFT</ticker>
                <
name>Microsoft Corporation</name>
                <
mktcap>314,571.156</mktcap>
                <
sales>32,187.000</sales>
                <
employees>55000</employees>
            </
company>
            <
company>
                <
ticker>ORCL</ticker>
                <
name>Oracle Corporation</name>
                <
mktcap>62,615.266</mktcap>
                <
sales>9,519.000</sales>
                <
employees>40650</employees>
            </
company>
            <
company>
                <
ticker>SAP</ticker>
                <
name>SAP AG (ADR)</name>
                <
mktcap>40,986.328</mktcap>
                <
sales>8,296.420</sales>
                <
employees>28961</employees>
            </
company>
            <
company>
                <
ticker>CA</ticker>
                <
name>Computer Associates Inter</name>
                <
mktcap>15,606.335</mktcap>
                <
sales>3,164.000</sales>
                <
employees>16000</employees>
            </
company>
            <
company>
                <
ticker>ERTS</ticker>
                <
name>Electronic Arts Inc.</name>
                <
mktcap>14,490.895</mktcap>
                <
sales>2,503.727</sales>
                <
employees>4000</employees>
            </
company>
        </
companies>
    </
xml>
    <
script>

    
//    create ActiveWidgets data model - XML-based table
    
var table = new AW.XML.Table;

    
//  get reference to the xml data island node
    
var xml document.getElementById("xmlDataIsland");

    
//    define data formats
    
var str = new AW.Formats.String;
    var 
num = new AW.Formats.Number;

    
table.setFormats([strstrnumnumnum]);

    
//    provide data XML
    
table.setXML(xml);

    
//    define column labels
    
var columns = ["Ticker""Company Name""Market Cap.""$ Sales""Employees"];

    
//    create ActiveWidgets Grid javascript object
    
var obj = new AW.UI.Grid;

    
obj.setColumnCount(5);
    
obj.setRowCount(5);

    
//    provide column labels
    
obj.setHeaderText(columns);

    
//    provide external model as a grid data source
    
obj.setCellModel(table);
    
    
obj.setCellTemplate(new AW.Templates.Checkbox2);

    
//    set initial value for column 2
    
obj.setCellValue(false2);

    
//    needed to get "checked" state
    
obj.setCellText(function(colrow){return this.getCellValue(colrow"yes" "no"}, 2);
    

    
//    write grid html to the page
    
document.write(obj);

    </
script>
</
body>
 
Steven
Friday, June 23, 2006



This topic is archived.

Back to support forum

Forum search