mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-18 20:08:34 +01:00
Etemplate: Better calculation for all fixed width columns to properly fit given width
This one avoids potential overflow due to rounding
This commit is contained in:
parent
cd2ea60fbd
commit
6ce32d3e85
@ -434,12 +434,17 @@ var et2_dataview_columns = (function(){ "use strict"; return Class.extend({
|
|||||||
if(!column)
|
if(!column)
|
||||||
{
|
{
|
||||||
// Distribute shortage over all fixed width columns
|
// Distribute shortage over all fixed width columns
|
||||||
|
var diff = Math.round(remaining_width / fixedCount);
|
||||||
for(var i = 0; i < this.columns.length; i++)
|
for(var i = 0; i < this.columns.length; i++)
|
||||||
{
|
{
|
||||||
var col = this.columns[i];
|
var col = this.columns[i];
|
||||||
|
var col_diff = (diff < 0 ?
|
||||||
|
Math.max(remaining_width, diff) :
|
||||||
|
Math.min(remaining_width, diff)
|
||||||
|
);
|
||||||
if(!col.fixedWidth) continue;
|
if(!col.fixedWidth) continue;
|
||||||
var diff = Math.round(remaining_width / fixedCount);
|
var new_width = this.columnWidths[i] - col_diff;
|
||||||
var new_width = this.columnWidths[i] - diff;
|
remaining_width -= col_diff;
|
||||||
this.columnWidths[i] = Math.max(0, Math.min(new_width,tw));
|
this.columnWidths[i] = Math.max(0, Math.min(new_width,tw));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user