allow to resize all columns (no need to leave out the last one) and use pageX instead of clientX to take into account an optional scrollbar, if grid is to wide

This commit is contained in:
Ralf Becker 2013-02-06 16:32:18 +00:00
parent 898b020fbf
commit 99eea070bb
2 changed files with 10 additions and 12 deletions

View File

@ -378,15 +378,13 @@ var et2_dataview = Class.extend({
.append(cont) .append(cont)
.appendTo(this.headTr); .appendTo(this.headTr);
// Every column but last can be resized // TODO: This won't work as the last column could be hidden // make column resizable
if(i < this.columns.length-1) { var enc_column = self.columnMgr.getColumnById(col.id);
var enc_column = self.columnMgr.getColumnById(col.id); et2_dataview_makeResizeable(column, function(_w) {
et2_dataview_makeResizeable(column, function(_w) { this.set_width(_w + "px");
this.set_width(_w + "px"); self.columnMgr.updated = true;
self.columnMgr.updated = true; self.updateColumns();
self.updateColumns(); }, enc_column);
}, enc_column);
}
// Store both nodes in the columnNodes array // Store both nodes in the columnNodes array
this.columnNodes.push({ this.columnNodes.push({

View File

@ -63,7 +63,7 @@
.bind("mousemove", function(e) { .bind("mousemove", function(e) {
didResize = true; didResize = true;
resizeWidth = Math.max(e.clientX - left + RESIZE_ADD, resizeWidth = Math.max(e.pageX - left + RESIZE_ADD,
RESIZE_MIN_WIDTH); RESIZE_MIN_WIDTH);
helper.css("width", resizeWidth + "px"); helper.css("width", resizeWidth + "px");
}) })
@ -107,12 +107,12 @@
// Bind the "mousemove" event in the "resize" namespace // Bind the "mousemove" event in the "resize" namespace
_elem.bind("mousemove.resize", function(e) { _elem.bind("mousemove.resize", function(e) {
_elem.css("cursor", inResizeRegion(e.clientX, _elem) ? "ew-resize" : "auto"); _elem.css("cursor", inResizeRegion(e.pageX, _elem) ? "ew-resize" : "auto");
}); });
// Bind the "mousedown" event in the "resize" namespace // Bind the "mousedown" event in the "resize" namespace
_elem.bind("mousedown.resize", function(e) { _elem.bind("mousedown.resize", function(e) {
if (inResizeRegion(e.clientX, _elem)) if (inResizeRegion(e.pageX, _elem))
{ {
// Start the resizing // Start the resizing
startResize(outerTable, _elem, function(_w) { startResize(outerTable, _elem, function(_w) {