mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-18 04:31:06 +01:00
When user changes the width of a relative width column, make sure that column stays at the set size and adjust all other relative columns to fit. Fixes relative width columns changing width again after being resized.
This commit is contained in:
parent
1c10588249
commit
12bfd30cbd
@ -395,9 +395,36 @@ var et2_dataview = Class.extend({
|
||||
// make column resizable
|
||||
var enc_column = self.columnMgr.getColumnById(col.id);
|
||||
et2_dataview_makeResizeable(column, function(_w) {
|
||||
this.set_width(this.relativeWidth ? (_w / self.columnMgr.totalWidth) : _w + "px");
|
||||
self.columnMgr.updated = true;
|
||||
self.updateColumns();
|
||||
|
||||
// User wants the column to stay where they put it, even for relative
|
||||
// width columns, so set it explicitly first and adjust other relative
|
||||
// columns to match.
|
||||
if(this.relativeWidth)
|
||||
{
|
||||
// Set to selected width
|
||||
this.set_width(_w + "px");
|
||||
self.columnMgr.updated = true;
|
||||
self.updateColumns();
|
||||
|
||||
// Set relative widths to match
|
||||
var relative = self.columnMgr.totalWidth - self.columnMgr.totalFixed + _w;
|
||||
this.set_width(_w / relative);
|
||||
for(var i = 0; i < self.columnMgr.columns.length; i++)
|
||||
{
|
||||
var col = self.columnMgr.columns[i];
|
||||
if(col == this || col.fixedWidth) continue;
|
||||
col.set_width(self.columns[i].width / relative);
|
||||
}
|
||||
// Don't update now, or columns might change a little.
|
||||
// Save it for next time.
|
||||
}
|
||||
else
|
||||
{
|
||||
this.set_width(this.relativeWidth ? (_w / self.columnMgr.totalWidth) : _w + "px");
|
||||
self.columnMgr.updated = true;
|
||||
self.updateColumns();
|
||||
}
|
||||
|
||||
}, enc_column);
|
||||
|
||||
// Store both nodes in the columnNodes array
|
||||
|
Loading…
Reference in New Issue
Block a user