changeset a622e7969a57 in sao:5.0
details: https://hg.tryton.org/sao?cmd=changeset&node=a622e7969a57
description:
        Compute colspan with a minimal of 1

        When container have a negative number of column, col is set to 0.
        The computation of colspan must be at least 1 otherwise the width of 
the cell
        is set to 0%.

        issue11604
        review439271004
        (grafted from 9b69fb52fc961cff7a58ab4f6034e9129cdd4199)
diffstat:

 src/view/form.js |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (41 lines):

diff -r 1cd0ed1d0d3b -r a622e7969a57 src/view/form.js
--- a/src/view/form.js  Wed Jun 15 09:21:27 2022 +0200
+++ b/src/view/form.js  Sat Jul 30 11:08:37 2022 +0200
@@ -574,7 +574,7 @@
                 i = 0;
                 row.children().map(function() {
                     var cell = jQuery(this);
-                    var colspan = Math.min(Number(cell.attr('colspan')), col);
+                    var colspan = Math.min(Number(cell.attr('colspan')), col 
|| 1);
                     if (cell.hasClass('xexpand') &&
                         (!jQuery.isEmptyObject(cell.children())) &&
                         (cell.children(':not(.tooltip)').css('display') != 
'none')) {
@@ -594,7 +594,7 @@
                     var reduce = function(previous, current) {
                         var cell = current[0];
                         var colspan = Math.min(
-                            Number(cell.attr('colspan')), col);
+                            Number(cell.attr('colspan')), col || 1);
                         return previous + colspan;
                     };
                     return a.reduce(reduce, 0) - b.reduce(reduce, 0);
@@ -609,7 +609,8 @@
                 xexpands.forEach(function(e) {
                     var cell = e[0];
                     i = e[1];
-                    var colspan = Math.min(Number(cell.attr('colspan')), col);
+                    var colspan = Math.min(
+                        Number(cell.attr('colspan')), col || 1);
                     var current_width = 0;
                     for (j = 0; j < colspan; j++) {
                         current_width += widths[i + j] || 0;
@@ -637,7 +638,8 @@
                 i = 0;
                 row.children().map(function() {
                     var cell = jQuery(this);
-                    var colspan = Math.min(Number(cell.attr('colspan')), col);
+                    var colspan = Math.min(
+                        Number(cell.attr('colspan')), col || 1);
                     if (cell.hasClass('xexpand') &&
                         (cell.children(':not(.tooltip)').css('display') !=
                          'none')) {

Reply via email to