From 4b780e4f204bef01e76202d0a4dfccd92e4c41b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 21 Dec 2016 23:14:10 +0100 Subject: [PATCH] Manage negative value for col attribute issue2090 review29851002 --- src/view/form.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/view/form.js b/src/view/form.js index 00aef1c567..9f607754f5 100644 --- a/src/view/form.js +++ b/src/view/form.js @@ -458,6 +458,7 @@ function eval_pyson(value){ Sao.View.Form.Container = Sao.class_(Object, { init: function(col) { if (col === undefined) col = 4; + if (col < 0) col = 0; this.col = col; this.el = jQuery('', { 'class': 'form-container responsive responsive-noheader' @@ -480,14 +481,16 @@ function eval_pyson(value){ if (xfill === undefined) xfill = 1; var xexpand = attributes.xexpand; if (xexpand === undefined) xexpand = 1; - var len = 0; var row = this.row(); - row.children().map(function(i, e) { - len += Number(jQuery(e).attr('colspan') || 1); - }); - if (len + colspan > this.col) { - this.add_row(); - row = this.row(); + if (this.col > 0) { + var len = 0; + row.children().map(function(i, e) { + len += Number(jQuery(e).attr('colspan') || 1); + }); + if (len + colspan > this.col) { + this.add_row(); + row = this.row(); + } } var el; if (widget) {