2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

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

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

View File

@ -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 '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" '.

View File

@ -111,15 +111,23 @@ FW_jqueryReadyFn()
var id = $(this).attr("id");
if(!id || id.indexOf("TYPE") != 0)
return;
var maxTd=0, tdCount=[];
$(this).find("tr").each(function(){ // count the td's
var cnt=0;
$(this).find("td").each(function(){ cnt++; });
if(maxTd < cnt) maxTd = cnt;
var maxTd=0, tdCount=[], tbl = $(this);
$(tbl).find("> 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));
});
});
});