diff --git a/bi/base.js b/bi/base.js index 7d9636626..54edcd7ed 100644 --- a/bi/base.js +++ b/bi/base.js @@ -2684,10 +2684,10 @@ BI.CollectionView = BI.inherit(BI.Widget, { this.renderedCells[index]._height = datum.height; this.renderedCells[index].el.setHeight(datum.height); } - if (this.renderedCells[index].left !== datum.x) { + if (this.renderedCells[index]._left !== datum.x) { this.renderedCells[index].el.element.css("left", datum.x + "px"); } - if (this.renderedCells[index].top !== datum.y) { + if (this.renderedCells[index]._top !== datum.y) { this.renderedCells[index].el.element.css("top", datum.y + "px"); } renderedCells.push(child = this.renderedCells[index]); @@ -2705,6 +2705,8 @@ BI.CollectionView = BI.inherit(BI.Widget, { el: child, left: datum.x, top: datum.y, + _left: datum.x, + _top: datum.y, _width: datum.width, _height: datum.height }); @@ -14800,10 +14802,10 @@ BI.GridView = BI.inherit(BI.Widget, { this.renderedCells[index]._height = rowDatum.size; this.renderedCells[index].el.setHeight(rowDatum.size); } - if (this.renderedCells[index].left !== columnDatum.offset + horizontalOffsetAdjustment) { + if (this.renderedCells[index]._left !== columnDatum.offset + horizontalOffsetAdjustment) { this.renderedCells[index].el.element.css("left", (columnDatum.offset + horizontalOffsetAdjustment) + "px"); } - if (this.renderedCells[index].top !== rowDatum.offset + verticalOffsetAdjustment) { + if (this.renderedCells[index]._top !== rowDatum.offset + verticalOffsetAdjustment) { this.renderedCells[index].el.element.css("top", (rowDatum.offset + verticalOffsetAdjustment) + "px"); } renderedCells.push(child = this.renderedCells[index]); @@ -14823,6 +14825,8 @@ BI.GridView = BI.inherit(BI.Widget, { el: child, left: columnDatum.offset + horizontalOffsetAdjustment, top: rowDatum.offset + verticalOffsetAdjustment, + _left: columnDatum.offset + horizontalOffsetAdjustment, + _top: rowDatum.offset + verticalOffsetAdjustment, _width: columnDatum.size, _height: rowDatum.size }); @@ -32485,10 +32489,10 @@ BI.ResizableTableCell = BI.inherit(BI.Widget, { size = 0; offset = 0; defaultSize = o.width; - self.handler.element.removeClass("dragging"); - self.handler.element.removeClass("suitable"); startDrag = false; } + self.handler.element.removeClass("dragging"); + self.handler.element.removeClass("suitable"); mouseMoveTracker.releaseMouseMoves(); }, document); this.handler = BI.createWidget({ @@ -32508,6 +32512,7 @@ BI.ResizableTableCell = BI.inherit(BI.Widget, { }); this.handler.element.on("mousedown", function (event) { defaultSize = o.width; + optimizeSize(defaultSize); mouseMoveTracker.captureMouseMoves(event); }); BI.createWidget({ @@ -32758,13 +32763,14 @@ BI.ResizableTable = BI.inherit(BI.Widget, { self.resizer.setVisible(true); var height = o.headerRowSize + self._getRegionRowSize()[1]; self.resizer.setHeight(height); - if (o.minColumnSize[j]) { - if (size === o.minColumnSize[j]) { - self.resizer.element.addClass("suitable"); - } else { - self.resizer.element.removeClass("suitable"); - } - } + //TODO 不知道为什么加入这段代码会使得列宽调整出问题 + // if (o.minColumnSize[j]) { + // if (size === o.minColumnSize[j]) { + // self.resizer.element.addClass("suitable"); + // } else { + // self.resizer.element.removeClass("suitable"); + // } + // } self._setResizerPosition(self._getResizerLeft(j) + size, (o.header.length - 1) * o.headerRowSize); }; var stop = function (j, size) { @@ -32787,8 +32793,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, { result[i][j] = { type: "bi.resizable_table_cell", cell: col, - suitableSize: o.minColumnSize[i], - maxSize: o.maxColumnSize[i], + suitableSize: o.minColumnSize[j], + maxSize: o.maxColumnSize[j], resize: BI.bind(resize, null, j), stop: BI.bind(stop, null, j) }; @@ -32798,8 +32804,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, { result[r - 1][j] = { type: "bi.resizable_table_cell", cell: result[r - 1][j], - suitableSize: o.minColumnSize[i], - maxSize: o.maxColumnSize[i], + suitableSize: o.minColumnSize[j], + maxSize: o.maxColumnSize[j], resize: BI.bind(resize, null, j), stop: BI.bind(stop, null, j) }; diff --git a/docs/base.js b/docs/base.js index 7d9636626..54edcd7ed 100644 --- a/docs/base.js +++ b/docs/base.js @@ -2684,10 +2684,10 @@ BI.CollectionView = BI.inherit(BI.Widget, { this.renderedCells[index]._height = datum.height; this.renderedCells[index].el.setHeight(datum.height); } - if (this.renderedCells[index].left !== datum.x) { + if (this.renderedCells[index]._left !== datum.x) { this.renderedCells[index].el.element.css("left", datum.x + "px"); } - if (this.renderedCells[index].top !== datum.y) { + if (this.renderedCells[index]._top !== datum.y) { this.renderedCells[index].el.element.css("top", datum.y + "px"); } renderedCells.push(child = this.renderedCells[index]); @@ -2705,6 +2705,8 @@ BI.CollectionView = BI.inherit(BI.Widget, { el: child, left: datum.x, top: datum.y, + _left: datum.x, + _top: datum.y, _width: datum.width, _height: datum.height }); @@ -14800,10 +14802,10 @@ BI.GridView = BI.inherit(BI.Widget, { this.renderedCells[index]._height = rowDatum.size; this.renderedCells[index].el.setHeight(rowDatum.size); } - if (this.renderedCells[index].left !== columnDatum.offset + horizontalOffsetAdjustment) { + if (this.renderedCells[index]._left !== columnDatum.offset + horizontalOffsetAdjustment) { this.renderedCells[index].el.element.css("left", (columnDatum.offset + horizontalOffsetAdjustment) + "px"); } - if (this.renderedCells[index].top !== rowDatum.offset + verticalOffsetAdjustment) { + if (this.renderedCells[index]._top !== rowDatum.offset + verticalOffsetAdjustment) { this.renderedCells[index].el.element.css("top", (rowDatum.offset + verticalOffsetAdjustment) + "px"); } renderedCells.push(child = this.renderedCells[index]); @@ -14823,6 +14825,8 @@ BI.GridView = BI.inherit(BI.Widget, { el: child, left: columnDatum.offset + horizontalOffsetAdjustment, top: rowDatum.offset + verticalOffsetAdjustment, + _left: columnDatum.offset + horizontalOffsetAdjustment, + _top: rowDatum.offset + verticalOffsetAdjustment, _width: columnDatum.size, _height: rowDatum.size }); @@ -32485,10 +32489,10 @@ BI.ResizableTableCell = BI.inherit(BI.Widget, { size = 0; offset = 0; defaultSize = o.width; - self.handler.element.removeClass("dragging"); - self.handler.element.removeClass("suitable"); startDrag = false; } + self.handler.element.removeClass("dragging"); + self.handler.element.removeClass("suitable"); mouseMoveTracker.releaseMouseMoves(); }, document); this.handler = BI.createWidget({ @@ -32508,6 +32512,7 @@ BI.ResizableTableCell = BI.inherit(BI.Widget, { }); this.handler.element.on("mousedown", function (event) { defaultSize = o.width; + optimizeSize(defaultSize); mouseMoveTracker.captureMouseMoves(event); }); BI.createWidget({ @@ -32758,13 +32763,14 @@ BI.ResizableTable = BI.inherit(BI.Widget, { self.resizer.setVisible(true); var height = o.headerRowSize + self._getRegionRowSize()[1]; self.resizer.setHeight(height); - if (o.minColumnSize[j]) { - if (size === o.minColumnSize[j]) { - self.resizer.element.addClass("suitable"); - } else { - self.resizer.element.removeClass("suitable"); - } - } + //TODO 不知道为什么加入这段代码会使得列宽调整出问题 + // if (o.minColumnSize[j]) { + // if (size === o.minColumnSize[j]) { + // self.resizer.element.addClass("suitable"); + // } else { + // self.resizer.element.removeClass("suitable"); + // } + // } self._setResizerPosition(self._getResizerLeft(j) + size, (o.header.length - 1) * o.headerRowSize); }; var stop = function (j, size) { @@ -32787,8 +32793,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, { result[i][j] = { type: "bi.resizable_table_cell", cell: col, - suitableSize: o.minColumnSize[i], - maxSize: o.maxColumnSize[i], + suitableSize: o.minColumnSize[j], + maxSize: o.maxColumnSize[j], resize: BI.bind(resize, null, j), stop: BI.bind(stop, null, j) }; @@ -32798,8 +32804,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, { result[r - 1][j] = { type: "bi.resizable_table_cell", cell: result[r - 1][j], - suitableSize: o.minColumnSize[i], - maxSize: o.maxColumnSize[i], + suitableSize: o.minColumnSize[j], + maxSize: o.maxColumnSize[j], resize: BI.bind(resize, null, j), stop: BI.bind(stop, null, j) }; diff --git a/src/base/collection/collection.js b/src/base/collection/collection.js index 039b02ca4..3bb97c82d 100644 --- a/src/base/collection/collection.js +++ b/src/base/collection/collection.js @@ -166,10 +166,10 @@ BI.CollectionView = BI.inherit(BI.Widget, { this.renderedCells[index]._height = datum.height; this.renderedCells[index].el.setHeight(datum.height); } - if (this.renderedCells[index].left !== datum.x) { + if (this.renderedCells[index]._left !== datum.x) { this.renderedCells[index].el.element.css("left", datum.x + "px"); } - if (this.renderedCells[index].top !== datum.y) { + if (this.renderedCells[index]._top !== datum.y) { this.renderedCells[index].el.element.css("top", datum.y + "px"); } renderedCells.push(child = this.renderedCells[index]); @@ -187,6 +187,8 @@ BI.CollectionView = BI.inherit(BI.Widget, { el: child, left: datum.x, top: datum.y, + _left: datum.x, + _top: datum.y, _width: datum.width, _height: datum.height }); diff --git a/src/base/grid/grid.js b/src/base/grid/grid.js index 556040c04..1f09df86a 100644 --- a/src/base/grid/grid.js +++ b/src/base/grid/grid.js @@ -142,10 +142,10 @@ BI.GridView = BI.inherit(BI.Widget, { this.renderedCells[index]._height = rowDatum.size; this.renderedCells[index].el.setHeight(rowDatum.size); } - if (this.renderedCells[index].left !== columnDatum.offset + horizontalOffsetAdjustment) { + if (this.renderedCells[index]._left !== columnDatum.offset + horizontalOffsetAdjustment) { this.renderedCells[index].el.element.css("left", (columnDatum.offset + horizontalOffsetAdjustment) + "px"); } - if (this.renderedCells[index].top !== rowDatum.offset + verticalOffsetAdjustment) { + if (this.renderedCells[index]._top !== rowDatum.offset + verticalOffsetAdjustment) { this.renderedCells[index].el.element.css("top", (rowDatum.offset + verticalOffsetAdjustment) + "px"); } renderedCells.push(child = this.renderedCells[index]); @@ -165,6 +165,8 @@ BI.GridView = BI.inherit(BI.Widget, { el: child, left: columnDatum.offset + horizontalOffsetAdjustment, top: rowDatum.offset + verticalOffsetAdjustment, + _left: columnDatum.offset + horizontalOffsetAdjustment, + _top: rowDatum.offset + verticalOffsetAdjustment, _width: columnDatum.size, _height: rowDatum.size }); diff --git a/src/base/table/table.resizable.cell.js b/src/base/table/table.resizable.cell.js index cd1d565c8..f0bdaff98 100644 --- a/src/base/table/table.resizable.cell.js +++ b/src/base/table/table.resizable.cell.js @@ -56,10 +56,10 @@ BI.ResizableTableCell = BI.inherit(BI.Widget, { size = 0; offset = 0; defaultSize = o.width; - self.handler.element.removeClass("dragging"); - self.handler.element.removeClass("suitable"); startDrag = false; } + self.handler.element.removeClass("dragging"); + self.handler.element.removeClass("suitable"); mouseMoveTracker.releaseMouseMoves(); }, document); this.handler = BI.createWidget({ @@ -79,6 +79,7 @@ BI.ResizableTableCell = BI.inherit(BI.Widget, { }); this.handler.element.on("mousedown", function (event) { defaultSize = o.width; + optimizeSize(defaultSize); mouseMoveTracker.captureMouseMoves(event); }); BI.createWidget({ diff --git a/src/base/table/table.resizable.js b/src/base/table/table.resizable.js index bca89e215..1c0160380 100644 --- a/src/base/table/table.resizable.js +++ b/src/base/table/table.resizable.js @@ -216,13 +216,14 @@ BI.ResizableTable = BI.inherit(BI.Widget, { self.resizer.setVisible(true); var height = o.headerRowSize + self._getRegionRowSize()[1]; self.resizer.setHeight(height); - if (o.minColumnSize[j]) { - if (size === o.minColumnSize[j]) { - self.resizer.element.addClass("suitable"); - } else { - self.resizer.element.removeClass("suitable"); - } - } + //TODO 不知道为什么加入这段代码会使得列宽调整出问题 + // if (o.minColumnSize[j]) { + // if (size === o.minColumnSize[j]) { + // self.resizer.element.addClass("suitable"); + // } else { + // self.resizer.element.removeClass("suitable"); + // } + // } self._setResizerPosition(self._getResizerLeft(j) + size, (o.header.length - 1) * o.headerRowSize); }; var stop = function (j, size) { @@ -245,8 +246,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, { result[i][j] = { type: "bi.resizable_table_cell", cell: col, - suitableSize: o.minColumnSize[i], - maxSize: o.maxColumnSize[i], + suitableSize: o.minColumnSize[j], + maxSize: o.maxColumnSize[j], resize: BI.bind(resize, null, j), stop: BI.bind(stop, null, j) }; @@ -256,8 +257,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, { result[r - 1][j] = { type: "bi.resizable_table_cell", cell: result[r - 1][j], - suitableSize: o.minColumnSize[i], - maxSize: o.maxColumnSize[i], + suitableSize: o.minColumnSize[j], + maxSize: o.maxColumnSize[j], resize: BI.bind(resize, null, j), stop: BI.bind(stop, null, j) };