function setRowHeaders(grid, xml) {
var rowTextXpath = "//@header";
var hNodes = xml.selectNodes(rowTextXpath);
var maxWidth = 0;
if (hNodes) {
for (i = 0; i < hNodes.length; i++) {
grid.setRowText(hNodes[i].text, i);
width = grid.getRowTemplate(i).element().firstChild.scrollWidth;
if (maxWidth < width) {
maxWidth = width;
}
}
grid.setRowHeaderWidth(maxWidth);
grid.refresh();
alert("MaxWidth: " + maxWidth); // == 143, which seems correct.
}
}
grid.setRowHeaderWidth(maxWidth);
grid.refresh();
function setRowHeaders(grid, xml) {
var rowTextXpath = "//@header";
var hNodes = xml.selectNodes(rowTextXpath);
var maxWidth = 0;
if (hNodes) {
for (i = 0; i < hNodes.length; i++) {
grid.setRowText(hNodes[i].text, i);
width = grid.getRowTemplate(i).getItemTemplate(i).element().scrollWidth;
if (maxWidth < width) {
maxWidth = width;
}
}
grid.refresh();
grid.setRowHeaderWidth(maxWidth);
// If this refresh is done instead of the one upove, setRowHeaderWidth pops back to old value.
//grid.refresh();
}
obj.setRowHeaderWidth = function(width){
var layout = this.getTemplate("layout");
layout.getContent("left").setStyle("width", width);
layout.getContent("corner").setStyle("width", width);
layout.getContent("top").setStyle("padding-left", width);
layout.getContent("data").setStyle("padding-left", width);
};
layout.getContent("top").setStyle("paddingLeft", width);
layout.getContent("data").setStyle("paddingLeft", width);
width = grid.getRowTemplate(i).element().firstChild.scrollWidth;
getTemplate("left/item", i)
instead. But that do unfortunatly not seem to support the scrollWidth. I do not know how to measure the row header width at the moment.This topic is archived.