From dd8719f87c7183ed674a436f005dcd560cf23a0d Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Tue, 1 Aug 2017 08:16:06 +0000 Subject: [PATCH] fhemweb.js: fix colspan adjusting for tables (Forum #74849) git-svn-id: https://svn.fhem.de/fhem/trunk@14827 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/01_FHEMWEB.pm | 5 +++-- fhem/www/pgm2/fhemweb.js | 22 +++++++++++++++------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/fhem/FHEM/01_FHEMWEB.pm b/fhem/FHEM/01_FHEMWEB.pm index 43ae2f7d5..b6129aa0b 100755 --- a/fhem/FHEM/01_FHEMWEB.pm +++ b/fhem/FHEM/01_FHEMWEB.pm @@ -930,9 +930,10 @@ FW_answerCall($) $FW_lastHashUpdate = $lastDefChange; } - my $t = AttrVal($FW_wname, "title", - AttrVal("global", "title", "Home, Sweet Home")); + my $hsh = "Home, Sweet Home"; + my $t = AttrVal($FW_wname, "title", AttrVal("global", "title", $hsh)); $t = eval $t if($t =~ m/^{.*}$/s); # Forum #48668 + $t = $hsh if(!defined($t)); FW_pO ' tbody > tr").each(function(){ // count the td's + var cnt = 0, row=this; + $(row).find("> td").each(function(){ + var cs = $(this).attr("colspan"); + cnt += parseInt(cs ? cs : 1); + }); + if(maxTd < cnt) + maxTd = cnt; tdCount.push(cnt); }); - $(this).find("tr").each(function(){ // set the colspan - $(this).find("td").last().attr("colspan", maxTd-tdCount.shift()+1); + $(tbl).find("> tbody> tr").each(function(){ // set the colspan + var tdc = tdCount.shift(); + $(this).find("> td:last").each(function(){ + var cs = $(this).attr("colspan"); + $(this).attr("colspan", maxTd-tdc+(cs ? parseInt(cs) : 1)); + }); }); });