Thanks Johsuke, "sortbottom" did the job.

As for handling tfoot there are a couple of options (I'm not a DOM cross 
browser expert so I only have looked at this in Chrome - others may vary - but 
thead/tfoot/tbody where introduced in HTML4!)

Option1  - don't use table.rows - just use table.tBodies (which itself can have 
multiple tbody - so you would need to aggregate table.tBodies[0..n].rows[0..m]
(may loose backwards compatability here - but could always fall back?)

Option2 - table.tFoot.rows   (similar can then be done for table.tHead.rows if 
you want more than 1 row as a header...) then remove any of the rows present 
when looking at table.rows

/James

> -----Original Message-----
> From: jenkinsci-dev@googlegroups.com [mailto:jenkinsci-
> d...@googlegroups.com] On Behalf Of Kohsuke Kawaguchi
> Sent: 08 October 2013 19:56
> To: jenkinsci-dev@googlegroups.com
> Subject: Re: sortable tables with footers?
> 
> 
> 
> This should be in UI samples, but if the row has the class name "sortbottom",
> it'll always stick to the bottom. Similar effect for "sorttop".
> 
> Handling <tfoot> is a great idea. How does one check if a row is in tfoot? We
> can then change the "refresh" function accordingly.
> 
> 
> 
> On 10/08/2013 10:22 AM, teilo wrote:
> > HI all,
> >
> > Is it possible to generate a sortable table that has a footer as well as a
> header?
> >
> > I had a quick look at the source and it appears the sorter code treats all
> rows
> > apart from the first as sortable but wondered if there was any tricks to get
> > this working?
> >
> > I've tried putting the footer in a <tfoot> but that doesnkt work in IE or
> chrome :-(
> >
> > example of what I am trying to do
> >
> >       <table class="pane sortable" id="mytable">
> >         <thead>
> >         <tr>
> >           <td class="pane-header">Header1</td>
> >           <td class="pane-header" style="width:5em">Header1</td>
> >         </tr>
> >         </thead>
> >         <tbody>
> >           <!-- only entries in here should be sortable. -->
> >           <j:forEach var="p" items="${it.someList}">
> >             <tr>
> >               <td class="pane" data="${p.desc}">${p.desc}</td>
> >               <td class="pane" data="${p.value}">${p.value}</td>
> >             </tr>
> >           </j:forEach>
> >         </tbody>
> >         <tfoot>
> >           <!-- these entries also get sorted but should always be the last 
> > rows
> > :-( -->
> >           <tr>
> >             <td class="pane-header">Total</td>
> >             <td class="pane-header">${it.totalString}</td>
> >         </tr>
> >         </tfoot>
> >       </table>
> >
> > Thanks in advance.
> >
> > /James
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups
> > "Jenkins Developers" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> email
> > to jenkinsci-dev+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
> 
> 
> --
> Kohsuke Kawaguchi | CloudBees, Inc. | http://cloudbees.com/
> Try Jenkins Enterprise, our professional version of Jenkins
> 
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jenkinsci-dev+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to