X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/b37ceabb82336ee82757cd32efe353cfab8ec267..f5240829880f87e0cf581c6a296e436fdef0ef80:/src/widgets/list/ListView.js diff --git a/src/widgets/list/ListView.js b/src/widgets/list/ListView.js index 381ab994..c6099bfe 100644 --- a/src/widgets/list/ListView.js +++ b/src/widgets/list/ListView.js @@ -1,5 +1,5 @@ /*! - * Ext JS Library 3.2.2 + * Ext JS Library 3.3.0 * Copyright(c) 2006-2010 Ext JS, Inc. * licensing@extjs.com * http://www.extjs.com/license @@ -247,6 +247,9 @@ Ext.list.ListView = Ext.extend(Ext.DataView, { } if(c.width) { allocatedWidth += c.width*100; + if(allocatedWidth > this.maxColumnWidth){ + c.width -= (allocatedWidth - this.maxColumnWidth) / 100; + } colsWithWidth++; } columns.push(c); @@ -309,7 +312,7 @@ Ext.list.ListView = Ext.extend(Ext.DataView, { return { columns: this.columns, rows: rs - } + }; }, verifyInternalSize : function(){ @@ -320,30 +323,32 @@ Ext.list.ListView = Ext.extend(Ext.DataView, { // 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'; } }, @@ -352,11 +357,14 @@ Ext.list.ListView = Ext.extend(Ext.DataView, { 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; } } @@ -364,9 +372,13 @@ Ext.list.ListView = Ext.extend(Ext.DataView, { }, 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) + '%'; } } });