Index: branches/RC/core/admin_templates/js/script.js =================================================================== diff -u -N -r8929 -r9275 --- branches/RC/core/admin_templates/js/script.js (.../script.js) (revision 8929) +++ branches/RC/core/admin_templates/js/script.js (.../script.js) (revision 9275) @@ -13,7 +13,7 @@ var submitted = false; var $edit_mode = false; var $init_made = true; // in case of double inclusion of script.js :) - + // hook processing var hBEFORE = 1; // this is const, but including this twice causes errors var hAFTER = 2; // this is const, but including this twice causes errors @@ -443,7 +443,7 @@ submit_event($prefix_special, $event, $t); opener_action($prev_opener); // restore opener in parent window set_hidden_field('events[' + $prefix_special + ']', event_bak); // restore event - + // AJAX popup size respoce is received after std_edit_item/std_precreate_item function exit set_hidden_field($prefix_special + '_mode', null); } @@ -567,14 +567,14 @@ { var $kf = document.getElementById($form_name); var $field = $kf.elements[$field_id]; - + if ($value === null) { if ($field) { $kf.removeChild($field); } return true; } - + if ($field) { $field.value = $value; return true; @@ -812,7 +812,7 @@ function update_multiple_options($hidden_id) { var $select = document.getElementById($hidden_id + '_select'); var $result = ''; - + for (var $i = 0; $i < $select.options.length; $i++) { if ($select.options[$i].selected) { $result += $select.options[$i].value + '|'; @@ -1399,7 +1399,7 @@ if (!window.console || !console.firebug) { var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; - + window.console = {}; for (var i = 0; i < names.length; ++i) { window.console[names[i]] = function() { Index: branches/RC/core/kernel/db/db_event_handler.php =================================================================== diff -u -N -r9227 -r9275 --- branches/RC/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 9227) +++ branches/RC/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 9275) @@ -2095,6 +2095,32 @@ exit(); } + /** + * Enter description here... + * + * @param kEvent $event + */ + function OnSuggestValues(&$event) + { + safeDefine('DBG_SKIP_REPORTING', 1); + $lang =& $this->Application->recallObject('lang.current'); + header('Content-type: text/xml; charset='.$lang->GetDBField('Charset')); + + $field = $this->Application->GetVar('field'); + $cur_value = $this->Application->GetVar('cur_value'); + if (!$field || !$cur_value) exit; + $obj =& $event->getObject(); + $q = 'SELECT DISTINCT '.$field.' FROM '.$obj->TableName.' + WHERE '.$field.' LIKE '.$this->Conn->qstr($cur_value.'%').' ORDER BY '.$field.' LIMIT 0,20'; + $data = $this->Conn->GetCol($q); + echo ''; + foreach ($data as $item) { + echo "$item"; + } + echo ''; + exit; + } + } Index: branches/RC/core/admin_templates/js/grid_scroller.js =================================================================== diff -u -N -r8929 -r9275 --- branches/RC/core/admin_templates/js/grid_scroller.js (.../grid_scroller.js) (revision 8929) +++ branches/RC/core/admin_templates/js/grid_scroller.js (.../grid_scroller.js) (revision 9275) @@ -42,17 +42,57 @@ // preg_print_pre(this.Map, /last/); } -StyleManager.ChangeStyle = function(selector, style, value) +StyleManager.ChangeStyle = function(selector, s, value) { if (!this.Inited) this.InitStyles() rule = this.Map[selector.toLowerCase()]; if (!rule) { + if (this.AddStyle(selector, s, value)) { + return true; + } alert('rule '+selector+' not found') return; } - rule.style[style] = value; + alert('adjusting rule '+selector+' setting '+s+' to '+value+' from '+rule.style[s]) + rule.style[s] = value; + alert('now it is '+rule.style[s]) } +StyleManager.AddStyle = function(selector, style, value) +{ + var sheet = document.styleSheets[0]; + var rule = false; + if (sheet.insertRule) { + sheet.insertRule(selector+'{'+style+':'+value+'}', sheet.cssRules.length); + rule = sheet.cssRules[sheet.cssRules.length-1]; + } + else if(sheet.addRule) { + sheet.addRule(selector, style+':'+value); + rule = sheet.rules[sheet.rules.length-1]; + } + if (rule) { + alert ('adding rule as '+selector); + this.Map[selector.toLowerCase()] = sheet.cssRules[sheet.cssRules.length-1]; + return true; + } + return false; +} + +StyleManager.GetStyle = function(selector) +{ + if (!this.Inited) this.InitStyles() + rule = this.Map[selector.toLowerCase()]; + if (!rule) return false; + return rule; +} + +StyleManager.GetStyleValue = function(selector, style) +{ + rule = this.GetStyle(selector); + if (!rule) return false; + return rule.selector; +} + function preg_print_pre(obj, reg) { if (!reg) reg = /.*/; @@ -113,6 +153,10 @@ this.Rendered = false; this.PickerCRC = ''; + +// this.FixedHeights = true; + this.FixedHeaderHeights = [50,30]; + this.FixedRowHeight = 25; } GridScroller.prototype.Render = function(id) @@ -123,7 +167,11 @@ // this.MinWidths = [40,null,null,250] this.MinWidths = this.PrepareWidths(); // [50,70,90,150,150,110,70,111]; - html = this.AltHTML(); + document.body.style.height = '100%'; + document.body.style.overflow = 'hidden'; + document.body.scroll = 'no' + + // html = this.AltHTML(); // Profile('Getting HTML',1); if (id && id != '') { document.getElementById(id).innerHTML = '
'+html+'
'; @@ -134,24 +182,40 @@ this.Render('main_div_'+this.GridId); return; } - document.write('
'+html+'
'); + var dot = '
'; + document.write(dot); + var dot = document.getElementById('my_measure_'+this.GridId); + var measure = document.getElementById('my_measure_'+this.GridId); + this.pos = findPos(dot); +// alert('dot: '+this.pos[0]+','+this.pos[1]) + var collapse_correction = is.ie ? 0 : -1; + if (is.ie) this.pos[0] += 1; + +// this.MainOuter.style.width = 'auto' + var w = measure.offsetWidth; + var h = document.body.clientHeight; + var dim = getDimensions(measure); + h -= this.pos[1] + dim.padding[0] + dim.padding[2] + dim.borders[0] + dim.borders[2] + this.BottomOffset; + html = this.AltHTML(this.pos[0],this.pos[1], w, h); + document.write('
'+html+'
'); } this.Rendered = true; - this.SetReferences() +// Profile('Main render & refs',1) + this.SetReferences(); - document.body.style.height = '100%'; - document.body.style.overflow = 'hidden'; - document.body.scroll = 'no' +// return; if (getFrame('head').ScrollerW) { this.ScrollerW = getFrame('head').ScrollerW; this.ScrollerH = getFrame('head').ScrollerH; } else { - this.ScrollerW = this.MainInner.offsetWidth - this.MainInner.clientWidth + this.ScrollerW = 17; + this.ScrollerH = 17; + /*this.ScrollerW = this.MainInner.offsetWidth - this.MainInner.clientWidth this.ScrollerH = this.MainInner.offsetHeight - this.MainInner.clientHeight getFrame('head').ScrollerW = this.ScrollerW - getFrame('head').ScrollerH = this.ScrollerH + getFrame('head').ScrollerH = this.ScrollerH*/ } // Profile('Up to col widths',1); @@ -180,16 +244,30 @@ this.TheGrid.MainInner.scrollTop += -e.wheelDelta/2 this.TheGrid.SyncScroll(); } + if (this.LeftCells > 0) { + this.LeftDataInner.onmousewheel = function(ev) { + var e = document.all ? window.event : ev; + this.TheGrid.MainInner.scrollTop += -e.wheelDelta/2 + this.TheGrid.SyncScroll(); + } + } } else { this.DataScroller.addEventListener("DOMMouseScroll", function(ev) { var e = document.all ? window.event : ev; this.TheGrid.MainInner.scrollTop += e.detail*10 this.TheGrid.SyncScroll(); }, false); + if (this.LeftCells > 0) { + this.LeftDataInner.addEventListener("DOMMouseScroll", function(ev) { + var e = document.all ? window.event : ev; + this.TheGrid.MainInner.scrollTop += e.detail*10 + this.TheGrid.SyncScroll(); + }, false); + } } - addLoadEvent( function() {the_grid.AutoResize()} ); + addLoadEvent( function() {the_grid.AutoResize(); the_grid.SetResizeHandles();} ); } @@ -217,41 +295,48 @@ this.LeftHeaderTable = document.getElementById('left_header_'+this.GridId); this.LeftHeaderScroller = document.getElementById('inner_left_header_'+this.GridId); this.LeftHeaderOuter = document.getElementById('outer_left_header_'+this.GridId); + this.LeftHeaderInner = document.getElementById('inner_left_header_'+this.GridId); this.LeftDataTable = document.getElementById('left_data_'+this.GridId); - this.LeftDataScroller = document.getElementById('inner_left_data_'+this.GridId); this.LeftDataOuter = document.getElementById('outer_left_data_'+this.GridId); + this.LeftDataInner = document.getElementById('inner_left_data_'+this.GridId); if (this.HasFooter) { this.LeftFooterTable = document.getElementById('left_footer_'+this.GridId); - this.LeftFooterScroller = document.getElementById('inner_left_footer_'+this.GridId); + this.LeftFooterInner = document.getElementById('inner_left_footer_'+this.GridId); this.LeftFooterOuter = document.getElementById('outer_left_footer_'+this.GridId); } } this.DataScroller.TheGrid = this; this.MainInner.TheGrid = this; - this.Dot = document.getElementById('dot_'+this.GridId) + if (this.LeftCells > 0) this.LeftDataInner.TheGrid = this; +// this.Dot = document.getElementById('my_dot_'+this.GridId) this.MainOuter.className = 'grid-scrollable' if (!is.ie) { - this.MainOuter.style.marginLeft = '-1px'; +// this.MainOuter.style.marginLeft = '-1px'; } } +GridScroller.prototype.SetLeftHeights = function() { + if (this.LeftCells != 0) { + this.SetHeights('left_header_'+this.GridId, 'header_'+this.GridId); + this.SetHeights('left_data_'+this.GridId, 'data_'+this.GridId); + if (this.HasFooter()) { + this.SetHeights('left_footer_'+this.GridId, 'footer_'+this.GridId); + } + } +} + GridScroller.prototype.UpdateColWidths = function() { - pos = findPos(this.Dot) +// pos = findPos(this.Dot) + pos = this.pos; this.TheGrid.style.left = (pos[0])+ 'px' this.TheGrid.style.top = (pos[1]) + 'px' - if (this.LeftCells != 0) { - this.SetHeights('left_header_'+this.GridId, this.GetHeights('header_'+this.GridId)); - this.SetHeights('left_data_'+this.GridId, this.GetHeights('data_'+this.GridId)); - if (this.HasFooter()) { - this.SetHeights('left_footer_'+this.GridId, this.GetHeights('footer_'+this.GridId)); - } - } + this.SetLeftHeights(); if (this.HasFooter()) { this.FooterHeight = this.FooterTable.offsetHeight; @@ -262,6 +347,9 @@ } this.HeadHeight = this.HeadTable.offsetHeight; + +// console.log('measured Head Height: '+this.HeadHeight); + this.DataHeight = this.DataTable.offsetHeight; this.HeadOuter.style.height = (this.HeadHeight) + 'px' @@ -272,6 +360,7 @@ this.LeftFooterOuter.style.height = (this.FooterHeight) + 'px' this.LeftWidth = Math.max(this.LeftWidth, this.LeftFooterTable.offsetWidth); } +// console.log('measured Left Width: '+this.LeftWidth); } this.MainInner.onscroll = function() { @@ -280,26 +369,85 @@ this.MainOuter.style.width = 'auto' - this.HeaderWidth = this.HeadTable.offsetWidth + this.LeftWidth; - this.DataTotalHeight = this.DataHeight + this.HeadHeight + this.FooterHeight; + this.UpdateTotalDimensions(); return true; } -GridScroller.prototype.SetHeights = function(table_id, heights) +GridScroller.prototype.UpdateTotalDimensions = function() { - var table = document.getElementById(table_id); - for (var row=0; row' + table.rows[row].cells[0].innerHTML + '' - table.rows[row].cells[0].style.height = heights[row]+'px'; -// heights.push( table.rows[0].cells[0].offsetHeight ) -// alert('get ('+row+')'+table.rows[0].cells[0].innerHTML+' height '+table.rows[0].cells[0].offsetHeight) + // reseting heights + table1.rows[row].cells[0].style.height = 'auto'; + table2.rows[row].cells[0].style.height = 'auto'; + + var height1_div = document.getElementById(table1_id+'_left_height_'+row); + if (height1_div) { + height1_div.style.height = 'auto'; + } + var height2_div = document.getElementById(table2_id+'_left_height_'+row); + if (height2_div) { + height2_div.style.height = 'auto'; + } } -// return heights; } +GridScroller.prototype.SetHeights = function(table1_id, table2_id) +{ + if (this.FixedHeights) return; + var table1 = document.getElementById(table1_id); + var table2 = document.getElementById(table2_id); + var height1_div, height2_div; + + this.ResetHeights(table1_id, table2_id); + + var heights1 = this.GetHeights(table1_id); + var heights2 = this.GetHeights(table2_id); + var table, the_height, num; + + for (var row=0; row heights2[row]) + { + the_height = heights1[row]; + table = table2; + id = table2_id; + } + else { + the_height = heights2[row]; + table = table1; + id = table1_id; + } + var height_div = document.getElementById(id+'_left_height_'+row); + if (height_div) { // the div only exists for FF + height_div.style.height = the_height+'px'; + height_div.style.width = table.rows[row].cells[0].clientWidth+'px' + } + else { + if (!is.ie) { // firefox needs div, but it can display it as table-cell + var width = table.rows[row].cells[0].clientWidth; + table.rows[row].cells[0].innerHTML = '
' + table.rows[row].cells[0].innerHTML + '
' + } + } + // IE can't display div as table-cell, but it respects the tr height + table.rows[row].cells[0].style.height = the_height+'px'; +// table.rows[row].style.height = the_height+'px'; + } +} + GridScroller.prototype.GetHeights = function(table_id) { var table = document.getElementById(table_id); @@ -332,6 +480,174 @@ return widths; } +GridScroller.prototype.SetResizeHandles = function() +{ + var points = new Array(); + + if (this.LeftCells > 0) { + var table = this.LeftHeaderTable; + var points = new Array(); + if (!table.rows[0]) return []; + for (var col=0; col 15) { + var resize_bar = document.getElementById('resize_bar'); + resize_bar.style.left = (coords.x - DragManager.MouseOffset[0] + 2) + 'px'; + } + }, + function(a_handle) { + var resize_bar = document.getElementById('resize_bar'); + resize_bar.style.display = 'none'; + coords = findPos(a_handle); + var offset = (coords[0] - DragManager.InitialPos[0]); +// alert('offset: '+offset+' ('+coords[0]+' - '+DragManager.MouseOffset[0]+' - '+DragManager.InitialPos[0]+')'); + var col_num = a_handle.col_num; + var cur_w = scroller.GetColWidth(col_num); + if (cur_w + offset < 15) { + offset = 15-cur_w; + } + scroller.SetColWidth(col_num, cur_w+offset); + scroller.Resize( scroller.GetAutoSize() ); + scroller.ScrollResizeHandles(); + DragManager.InitialPos = [coords[0] - DragManager.MouseOffset[0], coords[1] - DragManager.MouseOffset[1]]; + + } + ) + } +} + +GridScroller.prototype.GetColWidth = function(col) +{ + return this.MinWidths[col]; +} + +GridScroller.prototype.SetColWidth = function(col, width) +{ + if (col >= this.LeftCells) { + if (this.DataTable.rows.length) this.DataTable.rows[0].cells[col - this.LeftCells].style.width = width+'px'; + for (var row=0; row < this.HeadTable.rows.length; row++) + { + this.HeadTable.rows[row].cells[col - this.LeftCells].style.width = width+'px'; + var a = document.getElementById('cursor_work_around_A_'+col+'_'+row); + var b = document.getElementById('cursor_work_around_B_'+col+'_'+row); + if (a) a.style.width = width+'px'; + if (b) b.style.width = width+'px'; + } + if (this.HasFooter()) { + this.FooterTable.rows[0].cells[col - this.LeftCells].style.width = width+'px'; + } + } + else { + if (this.LeftDataTable.rows.length) this.LeftDataTable.rows[0].cells[col].style.width = width+'px'; + for (var row=0; row < this.LeftHeaderTable.rows.length; row++) + { + this.LeftHeaderTable.rows[row].cells[col].style.width = width+'px'; + var a = document.getElementById('cursor_work_around_A_'+col+'_'+row); + var b = document.getElementById('cursor_work_around_B_'+col+'_'+row); + if (a) a.style.width = width+'px'; + if (b) b.style.width = width+'px'; + } + if (this.HasFooter()) { + this.LeftFooterTable.rows[0].cells[col].style.width = width+'px'; + } + + var cur_left_total_w = 0; + var new_left_total_w = 0; + for (var i=0; i < this.LeftCells; i++) { + cur_left_total_w += this.MinWidths[i]; + new_left_total_w += i==col? width : this.MinWidths[i]; + }; + var left_diff = this.LeftWidth - cur_left_total_w; + + this.SetLeftWidth(new_left_total_w+left_diff); + } + + this.MinWidths[col] = width; + this.SetLeftHeights(); + this.UpdateTotalDimensions(); + this.SyncScroll(); +} + +GridScroller.prototype.ScrollResizeHandles = function() +{ + for (var col=1; col left_most_pos[0] + this.DataOuter.clientWidth) { + handle.style.display = 'none'; //resize handle is outside of visible range + } + else { + handle.style.display = 'block'; + } + handle.style.left = n_left+'px'; + } +} + GridScroller.prototype.GetAutoSize = function() { this.MainOuter.style.width = 'auto' @@ -358,12 +674,13 @@ this.ResizeTimer = window.setTimeout(function() { obj.Resize( obj.GetAutoSize() ); obj.ResizeHappening = false; -// alert('resized') }, 300) } GridScroller.prototype.Resize = function(w,h) { +// alert('-1'); + if (typeof(w) == 'object') { h = w[1]; w = w[0]; @@ -372,7 +689,8 @@ if (h) this.Height = h; var x,y; - pos = findPos(this.Dot) +// pos = findPos(this.Dot) + pos = this.pos; x = pos[0]; y = pos[1]; @@ -385,9 +703,12 @@ this.MainOuter.style.height = (this.Height)+'px' this.MainOuter.style.width = (this.Width)+'px' - // alert('1'); + var scroller_width; + +// this.HeadTable.rows[0].cells[(this.HeadTable.rows[0].cells.length-1)].offsetWidth + scroller_height = this.HeaderWidth > 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; @@ -404,13 +725,7 @@ // alert('1.5'); - if (this.LeftCells != 0) { - this.LeftHeaderOuter.style.width = (this.LeftWidth) + 'px' - this.LeftDataOuter.style.width = (this.LeftWidth) + 'px' - if (this.HasFooter()) { - this.LeftFooterOuter.style.width = (this.LeftWidth) + 'px' - } - } + this.SetLeftWidth(); // alert('2'); @@ -436,7 +751,35 @@ this.MainScroller.style.height = ( this.DataHeight + this.HeadHeight + this.FooterHeight)+'px' // alert('4'); +} +GridScroller.prototype.SetLeftWidth = function(left_width) +{ + if (left_width) this.LeftWidth = left_width; + if (this.LeftCells != 0) { + + // there was -1 for Mozilla, but somehow it's not needed anymore... + this.LeftHeaderOuter.parentNode.style.width = (this.LeftWidth + (is.ie ? 0 : 0) ) + 'px'; + + this.LeftHeaderOuter.style.width = (this.LeftWidth) + 'px'; + this.LeftHeaderInner.style.width = (this.LeftWidth) + 'px'; + + this.LeftDataOuter.style.width = (this.LeftWidth) + 'px'; + this.LeftDataInner.style.width = (this.LeftWidth) + 'px'; + if (this.HasFooter()) { + this.LeftFooterOuter.style.width = (this.LeftWidth) + 'px'; + this.LeftFooterInner.style.width = (this.LeftWidth) + 'px' + } + + // this is IE workaround, we have to set inner div width to given px (above) and then back to 100% + // for IE to readjust the surrounding tables, otherwise it memorizes inner div pixel width and + // cannot make surrounding table cells smaller then that + this.LeftHeaderInner.style.width = '100%'; + this.LeftDataInner.style.width = '100%'; + if (this.HasFooter()) { + this.LeftFooterInner.style.width = '100%'; + } + } } GridScroller.prototype.SyncScroll = function() @@ -449,46 +792,71 @@ this.DataScroller.scrollTop = this.MainInner.scrollTop; if (this.LeftCells != 0) { - this.LeftDataScroller.scrollTop = this.MainInner.scrollTop; + this.LeftDataInner.scrollTop = this.MainInner.scrollTop; } + this.ScrollResizeHandles(); } -GridScroller.prototype.AltHTML = function() +GridScroller.prototype.AltHTML = function(x,y,w,h) { var o = ''; - o += this.CreateScroller( '


', 100, 100, 'main_'+this.GridId, false, 1 ); + o += this.CreateScroller( '
', w, h, 'main_'+this.GridId, false, 1, 'grid-scrollable' ); - o += '' + + o += '
'; + var header_rows = this.Header.length; var cols = this.Header[0].length; var data_rows = this.Data.length; - var header = this.GetTableWithScroller(this.Header, [this.LeftCells, 0, cols, header_rows], 'header') - var data = this.GetTableWithScroller(this.Data, [this.LeftCells, 0, cols, data_rows], 'data', 'grid-data-row-even', '') - var footer = this.HasFooter() ? this.GetTableWithScroller(this.Footer, [this.LeftCells], 'footer') : ''; + var footer_rows = this.Footer.length; - var left_header = this.GetTableWithScroller(this.Header, [0,0,this.LeftCells, header_rows], ['header','left_header']) - var left_data = this.GetTableWithScroller(this.Data, [0,0,this.LeftCells, data_rows], ['data','left_data'], 'grid-data-row-even', 'left_') - var left_footer = this.GetTableWithScroller(this.Footer, [0,0,this.LeftCells], ['footer','left_footer']) + var header_h = 80; + if (this.FixedHeights) { + for (var i=0; i';*/ if (this.LeftCells != 0) { - o += '' - o += '' - o += '' - o += '' - o += '' + o += '
' + left_header + '' + header + '
' + left_data + '' + data + '
\n' + o += '\n\n' + o += '\n\n' + + o += '\n\n' + o += '\n\n' + if (this.HasFooter()) { o += '' o += '' } - o += '
\n' + left_header + '\n\n' + header + '\n
\n' + left_data + '\n\n' + data + '\n
' + left_footer + '' + footer + '
' + o += '\n' } else { o += header + data + footer; @@ -504,10 +872,13 @@ cache = new Object } - if (this.MinWidths.length == this.Header[0].length) { + if (this.MinWidths.length >= this.Header[0].length) { var has_all_widths = true; - for (var i in this.MinWidths) { - if (isNaN(parseInt(this.MinWidths[i]))) has_all_widths = false; + for (var i=0; i < this.MinWidths.length; i++) { + if (isNaN(parseInt(this.MinWidths[i]))) { + this.MinWidths[i] = 100; +// has_all_widths = false; + } } if (has_all_widths) { widths = this.MinWidths @@ -531,7 +902,7 @@ var w = document.all ? window.document.body.offsetWidth : window.innerWidth var table_width = w < 500 ? '1024px' : 'auto'; // console.log('tmp table width: %s (window width: %s)', table_width, w) - o = ''+o+'' + o = ''+o+'
' document.write(o) widths = this.GetWidths('tmp_'+this.GridId); @@ -544,13 +915,16 @@ return widths; } -GridScroller.prototype.GetTableWithScroller = function(source, dim, class_mode, even_class, id_prefix) +GridScroller.prototype.GetTableWithScroller = function(source, dim, class_mode, even_class, id_prefix, w, h) { +// console.log(source, dim, class_mode, even_class, id_prefix, w, h) var tmp = this.GetIdAndClassName(class_mode); var id = tmp[1]; + if (!h) h = 100; var cells = this.GetTableCells(source, dim, class_mode, even_class, id_prefix); // var cells = this.GetTableCells(source, dim, class_mode, even_class, id_prefix, false, true); - return this.CreateScroller(''+cells[0]+'
', cells[1], 100, id+'_'+this.GridId, true, 5); +// console.log('createing scroller %s w,h: %i,%i', id, cells[1],h) + return this.CreateScroller('\n'+cells[0]+'\n
\n\n', cells[1], h, id+'_'+this.GridId, true, 5); } GridScroller.prototype.GetIdAndClassName = function(class_mode) @@ -582,36 +956,40 @@ if (id_prefix==null) id_prefix = id; var needs_last = needs_last == null ? (end_col == source[0].length) : needs_last; var total_width = 0; - var width_printed = false; + var width_printed = false; + for (var row=start_row; row'+"\n" even = !even; total_width = 0; + + if (this.FixedHeights) { + var height_style = id.match(/^(left_)?header/) ? 'height: '+this.FixedHeaderHeights[row]+'px;' : 'height: '+this.FixedRowHeight+'px;'; + } + else { + var height_style = ''; + } + for (var col=start_col; col
', '
']; + total_width += this.MinWidths[col]+12; + + var cursor_workaround = ['','']; + if (id.match(/^(left_)?header/)) { + if (is.gecko) { + var cursor_workaround = ['
', '
']; + } + /*else { + var cursor_workaround = ['
','
'] + }*/ } - else { - var cursor_workaround = ['',''] - } - 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 += "\t"+''+cursor_workaround[0]+source[row][col]+cursor_workaround[1]+''+"\n" - } + + var width_style = width_printed ? '' : 'style="width: '+this.MinWidths[col]+'px;"' + rh += "\t"+''+cursor_workaround[0]+source[row][col]+cursor_workaround[1]+''+"\n" } - width_printed = true; + width_printed = true; // print widths in first row only if (needs_last) { rh += "\t"+''+"\n" } @@ -627,8 +1005,12 @@ return (this.Footer != false) } -GridScroller.prototype.CreateScroller = function(content, w, h, id, hidden, z) +var colors = ['red', 'blue', 'green', 'pink', 'orange', 'brown', 'yellow', 'magenta', '#999', '#AAA', '#BBB', '#CCC', '#DDD', '#EEE', '#FFF']; +var next_color = 0; + +GridScroller.prototype.CreateScroller = function(content, w, h, id, hidden, z, outer_class) { +// console.log('creating scroller: ',w,h,id,hidden,z) if (hidden) { overflow = 'hidden' } @@ -647,8 +1029,9 @@ inner_id = ''; } var o = ''; - o += '
' - o += '
' + if (!outer_class) outer_class='scoller-outer'; + o += '
' + o += '
' o += content o += '
' return o @@ -662,6 +1045,7 @@ GridScroller.prototype.SetHeader = function(a_header) { this.Header = a_header; + this.FixedHeaderHeightCorrection = (6*this.Header.length)+1; } GridScroller.prototype.SetFooter = function(a_footer)