Help Reqd with Checkbox & XML table


I am stuck at couple of places using the following code. ( to run the code below, please create an HTML page and correct the aw include files path).

1) The Selected value of Checkbox in the result xml is coming as -1 or 0.
( please press the button to see the output)

2) First click on the checkboxes doesnt change the checked status. You have to click it two times to change the state. After that it changes the state every time you click.

3) Values changed in cells other than checkbox is not being displayed in the output xml.

Please let me know where am I going wrong.

thank you,

    <title>ActiveWidgets Examples</title>
    <script src="../../runtime/lib/aw.js"></script>
    <link href="../../runtime/styles/xp/aw.css" rel="stylesheet"></link>
        .aw-alternate-even {background: #F5F5DC}
        .aw-alternate-odd {background: #E1E1CA;}
        .aw-mouseover-row {background: #F9F99C;}

    var colsXPath = ["@checked","name","age","school","location"];
    var rowsXPath = "//person";
    var header = ["","name","age","school","location"];
    var obj = new AW.UI.Grid;
    var table = new AW.XML.Table;
    var chkTemplate = 	new AW.Templates.Checkbox

    function createGrid() {
        obj.setHeaderTemplate(chkTemplate, 0);
        obj.setHeaderValue(true, 0);

        obj.onHeaderValueChanged =
                if ( index == 0 ) {

        var chkBox = new AW.Templates.Checkbox;
        obj.setCellTemplate(chkBox, 0);

        var data = document.getElementById("dataIsland").value;

        table.setValue = function (value, col, row) {
            var node = this.getNode(col,row);
            if ( node != null ) {
                node.value = value;


        var tdiv = document.getElementById("tableDiv");
        tdiv.innerHTML = obj;


    function selectAllRows(bSelect) {
        var rows = obj.getRowCount();
        var table = obj.getCellModel();
        for (var i=0; i<rows; i++) {
            table.setValue(bSelect, 0, i);

    function showXML() {
        alert(' changed XML ->'+obj.getCellModel().getXML().xml);


<body onload="createGrid()">

<div id="tableDiv" name="tableDiv"></div>

<div id="buttonDiv" name="buttonDiv">
    <input type="button" id="showXML" name="showXML" value="Show XML" onclick="showXML();"/>

<input type="hidden" id='dataIsland' name='dataIsland' value="
    <person checked='false'>
    <person checked='false'>
August 28,
I am really struggling with this one. I am using the version "activewidgets-2.0.1-std-developer".

any help will be greatly appreciated.
August 28,

You need to add setText method to solve your problem (3).

I dont know why the issue (1) is happening, but you could workaround it by explicitly passing true or false value in setValue method.

Also noticed that no events are fired when each checkbox is clicked. Probably Alex can help.

table.setText = function (value, col, row) { 
            var node = this.getNode(col,row); 
            if ( node != null ) { 
                node.text = value; 

Raj Nair
August 29,
hey, were you able to find answer for this?
August 30,

I am still stuck with this same issue. Can someone please help on this.
September 4,

This topic is archived.

See also:

Back to support forum