[eGroupWare-svn] r55996 - /trunk/egroupware/api/js/etemplate/et2_dataview_model_columns.js

[email protected] Tue, 03 May 2016 20:55:39 -0000
Newsgroups gmane.comp.web.egroupware.cvs
Message-ID <[email protected]>
Author: nathangray
Date: Tue May  3 22:55:39 2016
New Revision: 55996

URL: http://svn.stylite.de/viewvc/egroupware?rev=55996&view=rev
Log:
If the total width of the columns is greater than what is available, distribute the shortage across fixed width columns

Modified:
    trunk/egroupware/api/js/etemplate/et2_dataview_model_columns.js

Modified: trunk/egroupware/api/js/etemplate/et2_dataview_model_columns.js
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/js/etemplate/et2_dataview_model_columns.js?rev=55996&r1=55995&r2=55996&view=diff
==============================================================================
--- trunk/egroupware/api/js/etemplate/et2_dataview_model_columns.js (original)
+++ trunk/egroupware/api/js/etemplate/et2_dataview_model_columns.js Tue May  3 22:55:39 2016
@@ -326,6 +326,7 @@
 		// Calculate how many space is - relatively - not occupied with columns with
 		// relative or fixed width
 		var totalRelative = 0;
+		var fixedCount = 0;
 		this.totalFixed = 0;
 
 		for (var i = 0; i < this.columns.length; i++)
@@ -351,6 +352,7 @@
 				else if (col.fixedWidth)
 				{
 					this.totalFixed += col.fixedWidth;
+					fixedCount++;
 				}
 			}
 		}
@@ -405,7 +407,8 @@
 			{
 				if(this.columns[columnIndex].visibility === ET2_COL_VISIBILITY_INVISIBLE ||
 					this.columns[columnIndex].visibility === ET2_COL_VISIBILITY_DISABLED ||
-					this.columnWidths[columnIndex] <= 0)
+					this.columnWidths[columnIndex] <= 0 ||
+					this.columnWidths[columnIndex] <= this.columns[columnIndex].minWidth)
 				{
 					continue;
 				}
@@ -423,12 +426,14 @@
 			}
 			if(!column)
 			{
-				// No relative width columns, distribute proportionatly over all
+				// Distribute shortage over all fixed width columns
 				for(var i = 0; i < this.columns.length; i++)
 				{
 					var col = this.columns[i];
-					col.fixedWidth -= Math.round(this.columnWidths[i] / tw * remaining_width);
-					this.columnWidths[i] = Math.max(0, Math.min(col.fixedWidth,tw));
+					if(!col.fixedWidth) continue;
+					var diff = Math.round(remaining_width / fixedCount);
+					var new_width = this.columnWidths[i] - diff;
+					this.columnWidths[i] = Math.max(0, Math.min(new_width,tw));
 				}
 			}
 			else


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z