grid.defineCellProperty("color");
grid.getCellTemplate().setStyle("background", function(){
return this.getCellProperty("color");
});
table.getColor = function(col, row){
return this.getNode(col, row).getAttribute('color');
};
table.setColumns(['col1', 'col2', ..., 'col1/@color']);
grid.setCellColor(function(col, row){
return this.getCellData(colorColumnIndex, row);
});
table.setColumns(["Country", "Calls", "ASR", "PDD", "ALOC", "@bc", "@fc", "@ft"]);
obj.defineRowProperty("background", function(r){
return this.getCellText(5, r); // return 'background' column
});
myRow.setStyle("background", function(){
return this.getRowProperty("background");
});
<html>
<head>
<title>ActiveWidgets Examples</title>
<style>body {font: 12px Tahoma}</style>
<script src="../../runtime/lib/aw.js"></script>
<link href="../../runtime/styles/xp/aw.css" rel="stylesheet"></link>
</head>
<body>
<xml id="xmlDataIsland">
<records>
<r bc="#ff0000" fc="#000000" ft="Arial" fs="" >
<Country>Mexico</Country>
<Calls>3</Calls>
<ASR>0</ASR>
<PDD>0</PDD>
<ALOC>0</ALOC>
<More>+</More>
</r>
<r bc="#ff0000" fc="#000000" ft="Arial" fs="" >
<Country>Afghanistan</Country>
<Calls>2</Calls>
<ASR>0</ASR>
<PDD>1</PDD>
<ALOC>0</ALOC>
<More>+</More>
</r>
<r bc="#ff0000" fc="#000000" ft="Arial" fs="" >
<Country>Haiti</Country>
<Calls>23</Calls>
<ASR>0</ASR>
<PDD>0</PDD>
<ALOC>0</ALOC>
<More>+</More>
</r>
</records>
</xml>
<script>
var table = new AW.XML.Table;
var xml = document.getElementById("xmlDataIsland");
table.setColumns(["Country", "Calls", "ASR", "PDD", "ALOC", "@bc", "@fc", "@ft"]);
table.setXML(xml);
var obj = new AW.UI.Grid;
obj.setId("myGrid");
obj.setColumnCount(8);
obj.setRowCount(3);
obj.setCellModel(table);
obj.defineRowProperty("background", function(r){
return this.getCellText(5, r); // return 'background' column
});
var myRow = new AW.Grid.Row;
myRow.setStyle("background", function(){
return this.getRowProperty("background");
});
obj.setRowTemplate(myRow);
document.write(obj);
</script>
</body>
</html>
This topic is archived.