forked from extern/egroupware
Fixed problem with column widths not being calculated/displayed correctly
This commit is contained in:
parent
990e1701f5
commit
0607a2c9a8
@ -20,7 +20,7 @@
|
|||||||
var et2_dataview_dataProvider = Class.extend({
|
var et2_dataview_dataProvider = Class.extend({
|
||||||
|
|
||||||
getCount: function() {
|
getCount: function() {
|
||||||
return 1000;
|
return 10;
|
||||||
},
|
},
|
||||||
|
|
||||||
registerDataRow: function(_idx, _dataRow) {
|
registerDataRow: function(_idx, _dataRow) {
|
||||||
|
@ -127,6 +127,7 @@ var et2_dataview_gridContainer = Class.extend({
|
|||||||
|
|
||||||
// Rebuild the column stylesheets
|
// Rebuild the column stylesheets
|
||||||
this.columnMgr.setTotalWidth(_w - this.scrollbarWidth);
|
this.columnMgr.setTotalWidth(_w - this.scrollbarWidth);
|
||||||
|
et2_debug("log", _w - this.scrollbarWidth);
|
||||||
this._updateColumns();
|
this._updateColumns();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,42 +262,50 @@ var et2_dataview_gridContainer = Class.extend({
|
|||||||
|
|
||||||
// Ugly browser dependant code - each browser seems to treat the
|
// Ugly browser dependant code - each browser seems to treat the
|
||||||
// right (collapsed) border of the row differently
|
// right (collapsed) border of the row differently
|
||||||
var addBorder = 0;
|
var subBorder = 0;
|
||||||
|
var subHBorder = 0;
|
||||||
if ($j.browser.mozilla)
|
if ($j.browser.mozilla)
|
||||||
{
|
{
|
||||||
var maj = $j.browser.version.split(".")[0];
|
var maj = $j.browser.version.split(".")[0];
|
||||||
if (maj < 2) {
|
if (maj < 2) {
|
||||||
addBorder = 1; // Versions <= FF 3.6
|
subBorder = 1; // Versions <= FF 3.6
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($j.browser.webkit && !first)
|
if ($j.browser.webkit)
|
||||||
{
|
{
|
||||||
addBorder = 1;
|
if (!first)
|
||||||
|
{
|
||||||
|
subBorder = 1;
|
||||||
|
}
|
||||||
|
subHBorder = 1;
|
||||||
}
|
}
|
||||||
if (($j.browser.msie || $j.browser.opera) && first)
|
if (($j.browser.msie || $j.browser.opera) && first)
|
||||||
{
|
{
|
||||||
addBorder = -1;
|
subBorder = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make the last columns one pixel smaller, to prevent a horizontal
|
// Make the last columns one pixel smaller, to prevent a horizontal
|
||||||
// scrollbar from showing up
|
// scrollbar from showing up
|
||||||
if (vis_col == total_cnt)
|
if (vis_col == total_cnt)
|
||||||
{
|
{
|
||||||
addBorder += 1;
|
subBorder += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write the width of the body-columns
|
|
||||||
var columnWidth = Math.max(0, (col.width - this.columnBorderWidth - addBorder));
|
|
||||||
styleSheet.updateRule(".egwGridView_grid ." + col.divClass,
|
|
||||||
"width: " + columnWidth + "px;");
|
|
||||||
|
|
||||||
// Write the width of the header columns
|
// Write the width of the header columns
|
||||||
var headerWidth = Math.max(0, (col.width - this.headerBorderWidth));
|
var headerWidth = Math.max(0, (col.width - this.headerBorderWidth - subHBorder));
|
||||||
styleSheet.updateRule(".egwGridView_outer ." + col.divClass,
|
styleSheet.updateRule(".egwGridView_outer ." + col.divClass,
|
||||||
"width: " + headerWidth + "px;");
|
"width: " + headerWidth + "px;");
|
||||||
|
|
||||||
|
// Write the width of the body-columns
|
||||||
|
var columnWidth = Math.max(0, (col.width - this.columnBorderWidth - subBorder));
|
||||||
|
styleSheet.updateRule(".egwGridView_grid ." + col.divClass,
|
||||||
|
"width: " + columnWidth + "px;");
|
||||||
|
|
||||||
totalWidth += col.width;
|
totalWidth += col.width;
|
||||||
|
|
||||||
|
et2_debug("log", col.divClass, " cw: ", columnWidth, " hw: ",
|
||||||
|
headerWidth, " tw: ", totalWidth);
|
||||||
|
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -401,6 +410,10 @@ var et2_dataview_gridContainer = Class.extend({
|
|||||||
this.columnBorderWidth = this.constructor.prototype.columnBorderWidth =
|
this.columnBorderWidth = this.constructor.prototype.columnBorderWidth =
|
||||||
this._getColumnBorderWidth(clone);
|
this._getColumnBorderWidth(clone);
|
||||||
|
|
||||||
|
et2_debug("log", "Scrollbar width: ", this.scrollbarWidth);
|
||||||
|
et2_debug("log", "Header border width: ", this.headerBorderWidth);
|
||||||
|
et2_debug("log", "Column border width: ", this.columnBorderWidth);
|
||||||
|
|
||||||
// Remove the cloned DOM-Node again from the outer body
|
// Remove the cloned DOM-Node again from the outer body
|
||||||
clone.remove();
|
clone.remove();
|
||||||
}
|
}
|
||||||
|
@ -1052,7 +1052,7 @@ var et2_dataview_partitionSpacerNode = et2_dataview_partitionContainerNode.exten
|
|||||||
// created.
|
// created.
|
||||||
var ah = this._avgHeight;
|
var ah = this._avgHeight;
|
||||||
var startIdx = Math.max(0, Math.floor((_range.top - t) / ah));
|
var startIdx = Math.max(0, Math.floor((_range.top - t) / ah));
|
||||||
var stopIdx = Math.min(this._count - 1, Math.ceil((_range.bottom - t) / ah));
|
var stopIdx = Math.min(this._count, Math.ceil((_range.bottom - t) / ah));
|
||||||
|
|
||||||
if (startIdx > 0 && startIdx < this._count)
|
if (startIdx > 0 && startIdx < this._count)
|
||||||
{
|
{
|
||||||
|
@ -16,14 +16,24 @@
|
|||||||
et2_dataview_interfaces;
|
et2_dataview_interfaces;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
var __cc = 0;
|
||||||
|
|
||||||
var et2_dataview_row = et2_dataview_container.extend(et2_dataview_IDataRow, {
|
var et2_dataview_row = et2_dataview_container.extend(et2_dataview_IDataRow, {
|
||||||
|
|
||||||
init: function(_dataProvider, _rowProvider, _invalidationElem, _idx) {
|
init: function(_dataProvider, _rowProvider, _invalidationElem, _idx) {
|
||||||
|
|
||||||
this._super(_dataProvider, _rowProvider, _invalidationElem);
|
this._super(_dataProvider, _rowProvider, _invalidationElem);
|
||||||
|
|
||||||
|
__cc += 5;
|
||||||
|
|
||||||
this.tr = this.rowProvider.getPrototype("default");
|
this.tr = this.rowProvider.getPrototype("default");
|
||||||
$j("div", this.tr).text("Blub");
|
$j("div", this.tr).text("Blub" + (__cc / 5))
|
||||||
|
.height(20 + Math.round(Math.random() * 100))
|
||||||
|
.css("background-color", "rgb(" +
|
||||||
|
(255 - __cc % 255) + "," +
|
||||||
|
(__cc % 255) + "," +
|
||||||
|
((__cc * 2) % 255) +
|
||||||
|
")");
|
||||||
this.appendNode(this.tr);
|
this.appendNode(this.tr);
|
||||||
|
|
||||||
// Register this row in the dataprovider - if data is available for this
|
// Register this row in the dataprovider - if data is available for this
|
||||||
|
@ -80,6 +80,7 @@ var et2_dataview_rowProvider = Class.extend({
|
|||||||
.appendTo(tr);
|
.appendTo(tr);
|
||||||
var div = $j(document.createElement("div"))
|
var div = $j(document.createElement("div"))
|
||||||
.addClass(this._outerId + "_div_" + this._columnIds[i])
|
.addClass(this._outerId + "_div_" + this._columnIds[i])
|
||||||
|
.addClass("innerContainer")
|
||||||
.appendTo(td);
|
.appendTo(td);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,9 +147,6 @@ var et2_selectbox = et2_inputWidget.extend({
|
|||||||
* added after the "option"-widgets were added to selectbox.
|
* added after the "option"-widgets were added to selectbox.
|
||||||
*/
|
*/
|
||||||
set_select_options: function(_options) {
|
set_select_options: function(_options) {
|
||||||
|
|
||||||
var root = this;
|
|
||||||
|
|
||||||
// Add the select_options
|
// Add the select_options
|
||||||
for (var key in _options)
|
for (var key in _options)
|
||||||
{
|
{
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
/* Stuff for the standalone test webpage */
|
/* Stuff for the standalone test webpage */
|
||||||
|
|
||||||
body, table, td {
|
body, table, td {
|
||||||
font-family: Lucida Grande, sans-serif;
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
font-size: 10pt;
|
font-size: 11px;
|
||||||
/* overflow: hidden;*/
|
/* overflow: hidden;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user