<script>
var tbl = new AW.UI.Grid;
tbl.setSelectionMode("single-row");
tbl.setVirtualMode(true);
tbl.setCellText(function(col, row){return row + "," + col;});
tbl.setHeaderText("header");
tbl.setColumnCount(6);
tbl.setRowCount(2000);
// customize cell colors, except in selected row
tbl.getCellTemplate().setStyle("background", function(){
var col = this.$0;
var row = this.$1;
var selrows = tbl.getSelectedRows();
if (selrows && row == selrows[0])
return "highlight";
return (row+col) % 2 == 0 ? "white" : "red";});
// i need this else selected row is not highlighted (yuck)
tbl.onSelectedRowsChanged = function () {tbl.refresh();};
document.write(tbl);
</script>
<style>
.aw-mycolors-type1 {background: white}
.aw-mycolors-type2 {background: red}
</style>
<script>
var tbl = new AW.UI.Grid;
tbl.setSelectionMode("single-row");
tbl.setVirtualMode(true);
tbl.setCellText(function(col, row){return row + "," + col;});
tbl.setHeaderText("header");
tbl.setColumnCount(6);
tbl.setRowCount(2000);
// customize cell colors
tbl.getCellTemplate().setClass("mycolors", function(){
var col = this.$0;
var row = this.$1;
return (row+col) % 2 == 0 ? "type1" : "type2";
});
document.write(tbl);
</script>
<style>
.aw-mycolors-type1 {background: white}
.aw-mycolors-type2 {background: red}
</style>
<script>
var tbl = new AW.UI.Grid;
tbl.setSelectionMode("single-row");
tbl.setVirtualMode(true);
tbl.setCellText(function(col, row){return row + "," + col;});
tbl.setHeaderText("header");
tbl.setColumnCount(6);
tbl.setRowCount(2000);
// add new cell property
tbl.defineCellProperty("color", function(col, row){
return (row+col) % 2 == 0 ? "type1" : "type2";
});
// customize cell template
tbl.getCellTemplate().setClass("mycolors", function(){
return this.getCellProperty("color");
});
document.write(tbl);
</script>
<style>
.aw-rows-selected .aw-grid-cell {
background:none!important;
}
</style>
<script>
var tbl = new AW.UI.Grid;
tbl.setSelectionMode("single-row");
tbl.setVirtualMode(true);
tbl.setCellText(function(col, row){return row + "," + col;});
tbl.setHeaderText("header");
tbl.setColumnCount(6);
tbl.setRowCount(2000);
// customize cell colors, except in selected row
tbl.getCellTemplate().setStyle("background", function(){
var col = this.$0;
var row = this.$1;
return (row+col) % 2 == 0 ? "white" : "red";
});
document.write(tbl);
</script>
This topic is archived.