</head>
<body onload="prettyPrint();">
<pre class="prettyprint lang-js">/*!
- * Ext JS Library 3.2.1
- * Copyright(c) 2006-2010 Ext JS, Inc.
- * licensing@extjs.com
- * http://www.extjs.com/license
+ * Ext JS Library 3.3.1
+ * Copyright(c) 2006-2010 Sencha Inc.
+ * licensing@sencha.com
+ * http://www.sencha.com/license
*/
<div id="cls-Ext.list.ListView"></div>/**
* @class Ext.list.ListView
/*
* IE has issues when setting percentage based widths to 100%. Default to 99.
*/
- maxWidth: Ext.isIE ? 99 : 100,
+ maxColumnWidth: Ext.isIE ? 99 : 100,
initComponent : function(){
if(this.columnResize){
}
if(c.width) {
allocatedWidth += c.width*100;
+ if(allocatedWidth > this.maxColumnWidth){
+ c.width -= (allocatedWidth - this.maxColumnWidth) / 100;
+ }
colsWithWidth++;
}
columns.push(c);
// auto calculate missing column widths
if(colsWithWidth < len){
var remaining = len - colsWithWidth;
- if(allocatedWidth < this.maxWidth){
- var perCol = ((this.maxWidth-allocatedWidth) / remaining)/100;
+ if(allocatedWidth < this.maxColumnWidth){
+ var perCol = ((this.maxColumnWidth-allocatedWidth) / remaining)/100;
for(var j = 0; j < len; j++){
var c = cs[j];
if(!c.width){
return {
columns: this.columns,
rows: rs
- }
+ };
},
verifyInternalSize : function(){
// private
onResize : function(w, h){
- var bd = this.innerBody.dom;
- var hd = this.innerHd.dom;
- if(!bd){
+ var body = this.innerBody.dom,
+ header = this.innerHd.dom,
+ scrollWidth = w - Ext.num(this.scrollOffset, Ext.getScrollBarWidth()) + 'px',
+ parentNode;
+
+ if(!body){
return;
}
- var bdp = bd.parentNode;
+ parentNode = body.parentNode;
if(Ext.isNumber(w)){
- var sw = w - Ext.num(this.scrollOffset, Ext.getScrollBarWidth());
- if(this.reserveScrollOffset || ((bdp.offsetWidth - bdp.clientWidth) > 10)){
- bd.style.width = sw + 'px';
- hd.style.width = sw + 'px';
+ if(this.reserveScrollOffset || ((parentNode.offsetWidth - parentNode.clientWidth) > 10)){
+ body.style.width = scrollWidth;
+ header.style.width = scrollWidth;
}else{
- bd.style.width = w + 'px';
- hd.style.width = w + 'px';
+ body.style.width = w + 'px';
+ header.style.width = w + 'px';
setTimeout(function(){
- if((bdp.offsetWidth - bdp.clientWidth) > 10){
- bd.style.width = sw + 'px';
- hd.style.width = sw + 'px';
+ if((parentNode.offsetWidth - parentNode.clientWidth) > 10){
+ body.style.width = scrollWidth;
+ header.style.width = scrollWidth;
}
}, 10);
}
}
if(Ext.isNumber(h)){
- bdp.style.height = (h - hd.parentNode.offsetHeight) + 'px';
+ parentNode.style.height = Math.max(0, h - header.parentNode.offsetHeight) + 'px';
}
},
this.verifyInternalSize();
},
- findHeaderIndex : function(hd){
- hd = hd.dom || hd;
- var pn = hd.parentNode, cs = pn.parentNode.childNodes;
- for(var i = 0, c; c = cs[i]; i++){
- if(c == pn){
+ findHeaderIndex : function(header){
+ header = header.dom || header;
+ var parentNode = header.parentNode,
+ children = parentNode.parentNode.childNodes,
+ i = 0,
+ c;
+ for(; c = children[i]; i++){
+ if(c == parentNode){
return i;
}
}
},
setHdWidths : function(){
- var els = this.innerHd.dom.getElementsByTagName('div');
- for(var i = 0, cs = this.columns, len = cs.length; i < len; i++){
- els[i].style.width = (cs[i].width*100) + '%';
+ var els = this.innerHd.dom.getElementsByTagName('div'),
+ i = 0,
+ columns = this.columns,
+ len = columns.length;
+
+ for(; i < len; i++){
+ els[i].style.width = (columns[i].width*100) + '%';
}
}
});