:: Forum >>

Please contact the multi-grid

I am a multi- header layout you want

---------------------------------
main header -> | No | Sex | Rectal |
------------------
sub header -> | | man | woman | |
---------------------------------

Male gender sub- columns in the main header columns , divided by a woman
I would like to . Samples according to reports posted on the current site
No matter the grid is not working properly .
Below is the source I 've Sea

<script type="text/javascript">

// modified header template
AW.Grid.Header2 = AW.Grid.Header.subclass();
AW.Grid.Header2.create = function(){

var grid1 = this.prototype;
grid1.element = AW.System.HTML.prototype.element;

function display(){
var span = this.getHeaderProperty("span");
return span==0 ? "none" : null;
}

function width(){
var span = this.getHeaderProperty("span");
if (span == 1) {
return null;
}
var pos = this.getColumnProperty("position");
var a = this.getColumnProperty("indices");
var i, col, w = 0;
for (i=0; i<span; i++){
col = a ? a[pos+i] : pos+i; // column index
w += this.getColumnProperty("width", col);
}
return w;
}

grid1.setStyle("display", display);
grid1.setStyle("width", width);
};

var grid1Header = ["No","Sex","Rectal"];
var grid1Data = <%=grid1Data%>;

var df = new AW.Formats.Date; // 18:23 14-Feb-2006
df.setDataFormat("ISO8601"); // ³¯Â¥ Æ÷¸ä
df.setTextFormat("yyyy-mm-dd"); // ³¯Â¥ Æ÷¸ä
var nf = new AW.Formats.Number;
nf.setTextFormat("#,###.");

var grid1 = new AW.Grid.Extended;
grid1.wrapper = self;
grid1.setId("grid1");

grid1.defineHeaderProperty("span", 1);
grid1.setHeaderTemplate(new AW.Grid.Header2);
grid1.setHeaderIndices([0,1]);
grid1.setHeaderCount(2);
grid1.setHeaderHeight(30);
grid1.setHeaderText(grid1Header, 0);
grid1.setHeaderText(["man","woman"], 1);

// refresh multi-span headers on width change
grid1.adjustScrollWidth = function(){
var c, r, max = this.getColumnCount();
var a = this.getColumnIndices();
for (r=0; r<2; r++){
for (c=0; c<max; c++){
var row = r, col = a ? a[c] : c;
if (this.getHeaderSpan(c, r) > 1){
this.getHeaderTemplate(c, r).refresh();
}
}
}
}

// usage
//grid1.setHeaderSpan(1, 1, 1); // col-1 spans across 3 columns
grid1.setHeaderSpan(2, 0, 1); // col-1 spans across 3 columns
grid1.setHeaderSpan(0, 1, 1); // col-1 spans across 3 columns

grid1.setFixedLeft(4);

grid1.setRowHeight(30);
grid1.setCellData(grid1Data);
//grid1.setCellFormat(df, 6);
//grid1.setCellFormat(nf, 7);
//grid1.setCellFormat(nf, 8);
grid1.setColumnCount(2);
grid1.setRowCount(grid1Data.length);
grid1.setSelectionMode("multi-cell");
//grid1.setColumnResizable(false, 0);
//grid1.setHeaderTemplate(new AW.Templates.Checkbox, 0);
//grid1.setCellTemplate(new AW.Templates.Checkbox, 0);
grid1.setCellValue(false, 0);
grid1.setSelectionMultiple(true);
grid1.setVirtualMode(true);
grid1.refresh();
</script>

Your help is urgently needed .
Thank you.

chunsuk.jung
Tuesday, December 23, 2014

This topic is archived.


Back to support forum

Forum search