Index: trunk/core/admin_templates/js/grid_scroller.js =================================================================== diff -u -N -r7635 -r7855 --- trunk/core/admin_templates/js/grid_scroller.js (.../grid_scroller.js) (revision 7635) +++ trunk/core/admin_templates/js/grid_scroller.js (.../grid_scroller.js) (revision 7855) @@ -65,43 +65,8 @@ alert(p) } -function findPos(obj) { - var curleft = curtop = 0; - if (obj.offsetParent) { - curleft = obj.offsetLeft - curtop = obj.offsetTop - while (obj = obj.offsetParent) { - curleft += obj.offsetLeft - curtop += obj.offsetTop - } - } - return [curleft,curtop]; -} - var startTime,endTime; -function getDimensions(obj) { - var style - if (obj.currentStyle) { - style = obj.currentStyle; - } - else { - style = getComputedStyle(obj,''); - } - padding = [parseInt(style.paddingTop), parseInt(style.paddingRight), parseInt(style.paddingBottom), parseInt(style.paddingLeft)] - border = [parseInt(style.borderTopWidth), parseInt(style.borderRightWidth), parseInt(style.borderBottomWidth), parseInt(style.borderLeftWidth)] - for (var i in padding) if ( isNaN( padding[i] ) ) padding[i] = 0 - for (var i in border) if ( isNaN( border[i] ) ) border[i] = 0 - - var result = new Object(); - result.innerHeight = obj.clientHeight - padding[0] - padding[2]; - result.innerWidth = obj.clientWidth - padding[1] - padding[3]; - result.padding = padding; - result.borders = border; - - return result; -} - var profile = 0; var profile_total = 0; var startTime = new Date().getTime(); @@ -123,20 +88,6 @@ profile_total = 0; } -function addLoadEvent(func) { - var oldonload = window.onload; - if (typeof window.onload != 'function') { - window.onload = func; - } else { - window.onload = function() { - if (oldonload) { - oldonload(); - } - func(); - } - } -} - function GridScroller(grid_id, w, h) { this.GridId = grid_id @@ -203,7 +154,6 @@ getFrame('head').ScrollerH = this.ScrollerH } - // Profile('Up to col widths',1); if (!this.UpdateColWidths()) return; @@ -295,49 +245,6 @@ this.TheGrid.style.left = (pos[0])+ 'px' this.TheGrid.style.top = (pos[1]) + 'px' -// alert('MinWidths: '+this.MinWidths.length + ' vs Data ' + this.Header[0].length) - if (this.MinWidths.length < this.Header[0].length) { - var widths = new Array(); - var total = 0; - - StyleManager.ChangeStyle('td.grid-header-last-cell', 'width', '123px') - StyleManager.ChangeStyle('td.grid-data-last-cell', 'width', 'auto') - if (this.HasFooter()) { - StyleManager.ChangeStyle('td.grid-footer-last-cell', 'width', 'auto') - } - - if (this.LeftCells) { - widths.push(this.LeftHeaderTable.clientWidth) - } - - var header_widths = this.GetWidths('header_'+this.GridId); -// print_pre(header_widths) - var data_widths = this.GetWidths('data_'+this.GridId); -// print_pre(data_widths) - - for (var i=0; i this.Width ? this.ScrollerH : 0; scroller_width = this.DataTotalHeight > this.Height - scroller_height ? this.ScrollerW : 0; scroller_height = this.HeaderWidth > this.Width - scroller_width ? this.ScrollerH : 0; @@ -486,6 +397,13 @@ this.HeadOuter.style.width = (this.Width -scroller_width -this.LeftWidth)+ 'px'; this.DataOuter.style.width = (this.Width -scroller_width -this.LeftWidth)+ 'px'; +// alert('1.2'); + + this.TheGrid.style.width = (this.Width - scroller_width) + 'px'; + this.TheGrid.style.height = (this.Height - scroller_height) + 'px'; + +// alert('1.5'); + if (this.LeftCells != 0) { this.LeftHeaderOuter.style.width = (this.LeftWidth) + 'px' this.LeftDataOuter.style.width = (this.LeftWidth) + 'px' @@ -494,6 +412,8 @@ } } +// alert('2'); + if (this.HasFooter()) { this.FooterOuter.style.width = (this.Width -scroller_width -this.LeftWidth)+ 'px'; } @@ -510,11 +430,13 @@ this.LeftDataOuter.style.height = adjusted_data_height + 'px' } +// alert('3'); + this.MainScroller.style.width = (this.HeadTable.offsetWidth + this.LeftWidth)+'px' this.MainScroller.style.height = ( this.DataHeight + this.HeadHeight + this.FooterHeight)+'px' - this.TheGrid.style.width = (this.Width - scroller_width) + 'px'; - this.TheGrid.style.height = (this.Height - scroller_height) + 'px'; +// alert('4'); + } GridScroller.prototype.SyncScroll = function() @@ -535,7 +457,7 @@ { var o = ''; - o += this.CreateScroller( '


', 100, 100, 'main_'+this.GridId, false, 1 ); + o += this.CreateScroller( '


', 100, 100, 'main_'+this.GridId, false, 1 ); o += '']; + var cursor_workaround = ['
', '
']; } else { var cursor_workaround = ['',''] } - width = this.MinWidths[col] ? this.MinWidths[col] + 'px' : 'auto'; - total_width += this.MinWidths[col]; - if (no_inner_div) { - rh += ''+cursor_workaround[0]+source[row][col]+cursor_workaround[1]+'' + if (!width_printed) { + var width = this.MinWidths[col] ? this.MinWidths[col] + 'px' : 'auto'; + total_width += this.MinWidths[col]; +// if (no_inner_div) { + rh += "\t"+''+cursor_workaround[0]+source[row][col]+cursor_workaround[1]+''+"\n" +// } +// else { +// rh += ''+cursor_workaround[0]+'
'+source[row][col]+cursor_workaround[1]+'
' +// } } else { - rh += ''+cursor_workaround[0]+'
'+source[row][col]+cursor_workaround[1]+'
' + rh += "\t"+''+cursor_workaround[0]+source[row][col]+cursor_workaround[1]+''+"\n" } } + width_printed = true; if (needs_last) { - rh += '' + rh += "\t"+''+"\n" } - rh += '' + rh += ''+"\n" o += rh; } return [o, total_width];