File: [i]xml_test.cgi[/i]
#!/usr/bin/perl
print <<END;
Content-Type: text/xml; charset=ISO-8859-1
<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>
END
File: [i]test.html[/i]
<html>
<head>
<script src="/ActiveWidgets/runtime/lib/aw.js"></script>
<link href="/ActiveWidgets/runtime/styles/aqua/aw.css" rel="stylesheet"></link>
</head>
<body>
<script>
var d = new Date();
var data = new AW.XML.Table;
data.setURL('/cgi-bin/xml_test.cgi?' + d.getTime());
data.request();
var headers = [ "Ticker",
"Name",
"Mkt Cap",
"Sales",
"Employees",
];
var obj = new AW.Grid.Extended;
obj.setId('myGrid');
obj.setStyle('width', '700');
obj.setStyle('height', '300');
obj.setColumnCount(5);
obj.setHeaderText(headers);
obj.setCellModel(data);
obj.setVirtualMode(true);
obj.setSelectorText(function(i){return this.getRowPosition(i)+1});
obj.setSelectorVisible(true);
obj.setSelectorResizable(true);
obj.setHeaderHeight(20);
obj.setSelectorWidth(25);
obj.setRowCount(5000);
obj.setCellEditable(false); // disable editing
obj.setSelectionMode("multi-row");
document.write(obj);
// End Main Grid ######################################
// html event handler translates to grid events
function raiseMenuEvent(event){
this.raiseEvent("onRowContextMenu", event, this.$0);
}
// assign html event handler to row template
obj.setEvent("oncontextmenu", raiseMenuEvent);
// assign grid event handler
obj.onRowContextMenu = function(event, row){
alert("row=" + row + " x=" + event.clientX + " y=" + event.clientY);
}
</script>
</body>
</html>
This topic is archived.