Tallefer/wub

sorttable not closed at bottom

GoogleCodeExporter opened this issue · 1 comments

sorttables without footer are not closed at the bottom. This is because 
sorttable required footers to be used. This patch will use the headers as 
footers when no footers are specified in dict2html:

    # dict2table - convert dict into sortable HTML table
    proc dict2table {dict header {footer {}}} {
    if {![llength $footer]} {
        set footer $header
    }
    set row 0
    return [<table> class sortable [subst {
        [<thead> [<tr> [Foreach t $header {
        [<th> [string totitle $t]]
        }]]]
        [If {$footer ne {}} {
        [<tfoot> [<tr> [Foreach t $footer {[<th> [string totitle 
$t]]}]]]
        }]
        [<tbody> [Foreach {k v} $dict {
        [<tr> class [If {[incr row] % 2} even else odd] \
             [Foreach th $header {
             [If {[dict exists $v $th]} {
                 [<td> [dict get $v $th]]
             } else {
                 [<td> {}]
             }]
             }]]
        }]]
    }]]
    }

    # dict2table - convert dict into sortable HTML table
    # provisional new version
    proc dict2table {dict header {footer {}} {tag ""}} {
    if {![llength $footer]} {
        set footer $header
    }
    set row 0
    return [<table> class sortable [If {$tag ne ""} { class $tag
 }] [subst {
        [<thead> [<tr> [Foreach t $header {
        [<th> class $t [string totitle $t]]
        }]]]
        [If {$footer ne {}} {
        [<tfoot> [<tr> [Foreach t $footer {[<th> [string totitle 
$t]]}]]]
        }]
        [<tbody> [Foreach {k v} $dict {
        [<tr> class [If {[incr row] % 2} even else odd] \
             [Foreach th $header {
             [If {[dict exists $v $th]} {
                 [<td> class $th [dict get $v $th]]
             } else {
                 [<td> {}]
             }]
             }]]
        }]]
    }]]
    }

Original issue reported on code.google.com by jos.decoster on 8 Jan 2008 at 1:24

Original comment by jos.decoster on 10 Jan 2008 at 7:29

  • Changed state: Fixed