3.0 beta 2

AW.XML.Table doesn't let you edit cells

I downloaded 2.0 beta 2

I ran the grid.htm and it ran fine. I was able to edit cells with no problem.

I then modifed the code to load XML data into the table:

var table = new AW.XML.Table;
table.setURL("../data/VFP2.XML");
table.setRows("//vpn/firewall");
table.request();
var columns = ["Protocol","Status","Rule#","Description","policy","sourceip","destination_ip","source_port","dest_port"];

var obj = new AW.Grid.Extended;

obj.setCellModel(table)

This loaded the table correctly with the XML data:

The problme is that now I cannot edit a cell. It lets me enter the data but it does not retain (display) the new data.

Anybody run across this yet?

john signorello
November 26,
Yes, the same happens to me whenever i use the AW.XML.Table for the cell model.

I hope b3 should have this fix.. but dont know what's there in Alex's mind and in his b3 release.

With the current b2 i was able to give a workaround such as this:

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

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

  GC.obj=obj;

  //  provide data URL
  table.setURL(strDataSetURL);

  //  set rows XPath
  table.setRows("//NewDataSet/*");

  //  set columns XPath
  table.setColumns(GC.ColumnNodes);

  table._response_=eval(table.response);
  table.response=function(xml){
    // call the original proc
    table._response_(xml);

    var node = document.getElementById("gridCanvas");

    // alert(table.getText(0,0));
    // var rows=xml.documentElement.childNodes.length;
    var rows=table.getCount();
    if(rows && rows<100) obj.setVirtualMode(false);

    obj.setRowCount(rows);
    obj.setColumnCount(GC.ColumnNodes.length);

    //  enable row selectors
    obj.setSelectorVisible(true);
    obj.setSelectorText(function(i){return this.getRowPosition(i)+1;});
    obj.setSelectorWidth(25);

    obj.onSelectorClicked = function(event, index){
      // window.status = "Selector " + index + " clicked"
      obj.setSelectedRows([index]);
      var cols=[];
      for(var i=0; i < GC.ColumnNodes.length; i++){cols[i]=i;}
      obj.setSelectedColumns(cols);
    };

    // GC.data=GridConfig.get2DArrayFromFunction(table.getNode, rows, GC.ColumnNodes.length);
    // obj.setCellText(GC.data);
    var cc=0;
    
    // this is where i manually convert xml data to raw text-feed for the cells
    obj.setCellText(function(col, row){ return table.getText(col, row); } );
    obj.onCellTextChanged=function(){
      s='';
      for(var i in arguments)s+=(i+':'+arguments[i]+',');
      window.status=s;
    }

    node.innerHTML=obj;
  } // End table.response
Md. Sheriff, Drivestream
November 28,
I have an updated version of this code at:

/datagrid.1006/add-and-delete-a-row.html

Md. Sheriff, Drivestream
November 28,
Hi,

Great example, have one small question though, what is GC defined as?
Neil
December 12,

This topic is archived.

See also:


Back to support forum

Search

Version 2

Looking for AW 2.6 ?
The old site is here.