Resize column help.
In version 1, I use the code below to resize the column width
if( widths.length > 0 ){
if(columnWidths.length > 0){
widths = columnWidths;
}
var i, j, count = obj.getColumnCount();
var ss = document.styleSheets[document.styleSheets.length-1];
for (i=0; i<count;i++){
var width = widths[i]; //this.getTemplate("top/item", i).element().firstChild.scrollWidth;
var selector = "#" + obj.getId() + " .aw-column-" + i;
var rule = null;
if(width > 600){
width = 600;
}
for(j=0; j<ss.rules.length;j++){
if(ss.rules[j].selectorText == selector){
rule = ss.rules[j];
break;
}
}
if (rule) {
rule.style.width = width;
}
else {
ss.addRule(selector, "width:" + width + "px");
}
obj.getTemplate("layout").action("adjustSize");
}// for
}// if
if(typeof tableSort != "undefined"){
obj.sort(tableSort[0], tableSort[1]);
}
}
So, how should I work with version 2.0
Thanks,
if( widths.length > 0 ){
if(columnWidths.length > 0){
widths = columnWidths;
}
var i, j, count = obj.getColumnCount();
var ss = document.styleSheets[document.styleSheets.length-1];
for (i=0; i<count;i++){
var width = widths[i]; //this.getTemplate("top/item", i).element().firstChild.scrollWidth;
var selector = "#" + obj.getId() + " .aw-column-" + i;
var rule = null;
if(width > 600){
width = 600;
}
for(j=0; j<ss.rules.length;j++){
if(ss.rules[j].selectorText == selector){
rule = ss.rules[j];
break;
}
}
if (rule) {
rule.style.width = width;
}
else {
ss.addRule(selector, "width:" + width + "px");
}
obj.getTemplate("layout").action("adjustSize");
}// for
}// if
if(typeof tableSort != "undefined"){
obj.sort(tableSort[0], tableSort[1]);
}
}
So, how should I work with version 2.0
Thanks,
flashsnake
July 17,