fhemweb.js: fix colspan adjusting for tables (Forum #74849)

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@14827 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2017-08-01 08:16:06 +00:00
parent a04a3555b0
commit 5e3cde4e08
2 changed files with 18 additions and 9 deletions

View File

@ -930,9 +930,10 @@ FW_answerCall($)
$FW_lastHashUpdate = $lastDefChange; $FW_lastHashUpdate = $lastDefChange;
} }
my $t = AttrVal($FW_wname, "title", my $hsh = "Home, Sweet Home";
AttrVal("global", "title", "Home, Sweet Home")); my $t = AttrVal($FW_wname, "title", AttrVal("global", "title", $hsh));
$t = eval $t if($t =~ m/^{.*}$/s); # Forum #48668 $t = eval $t if($t =~ m/^{.*}$/s); # Forum #48668
$t = $hsh if(!defined($t));
FW_pO '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" '. FW_pO '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" '.

View File

@ -111,15 +111,23 @@ FW_jqueryReadyFn()
var id = $(this).attr("id"); var id = $(this).attr("id");
if(!id || id.indexOf("TYPE") != 0) if(!id || id.indexOf("TYPE") != 0)
return; return;
var maxTd=0, tdCount=[]; var maxTd=0, tdCount=[], tbl = $(this);
$(this).find("tr").each(function(){ // count the td's $(tbl).find("> tbody > tr").each(function(){ // count the td's
var cnt=0; var cnt = 0, row=this;
$(this).find("td").each(function(){ cnt++; }); $(row).find("> td").each(function(){
if(maxTd < cnt) maxTd = cnt; var cs = $(this).attr("colspan");
cnt += parseInt(cs ? cs : 1);
});
if(maxTd < cnt)
maxTd = cnt;
tdCount.push(cnt); tdCount.push(cnt);
}); });
$(this).find("tr").each(function(){ // set the colspan $(tbl).find("> tbody> tr").each(function(){ // set the colspan
$(this).find("td").last().attr("colspan", maxTd-tdCount.shift()+1); var tdc = tdCount.shift();
$(this).find("> td:last").each(function(){
var cs = $(this).attr("colspan");
$(this).attr("colspan", maxTd-tdc+(cs ? parseInt(cs) : 1));
});
}); });
}); });