// 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
This topic is archived.