Ticket #2527635 (closed enhancement)


Opened: 02/2/09
Last modified: 12/22/10
Status: closed
Type: enhancement
Resolution: wontfix


Jenny Donnelly
Target Release: 2.9.0
Priority: P3 (normal)
Summary: Enhance datatable & datasource to cater for table footers

Currently the datasource HTML table parser only processes rows in the table body. Also the datatable widget only uses a table body (tbody) to display the rows in the recordset.
If I am doing progressive enhancement of a table that includes e.g. subtotals & totals in a footer (tfoot) section, I have to reproduce these programmatically after creating the datatable instance,
using appropriate DOM manipulation. Asides from the amount of code this requires, it is also awkward to reproduce the appropriate CSS classes to let it fit in with the look of the rest of the table.

To make this easier, I suggest the following enhancements:
- add methods to add/delete/update rows in the footer section, similar to the existing addRow[s]/deleteRow[s]/update[Row|Cell] for the body. Presumably a second recordset would be needed to store the
footer records. The methods would automatically add cells, liner divs, the various CSS classes e.g. yui-dt-col-*, and use the specified formatter for the column (unless told not to? e.g. it may not
be desirable to use formatLink on a TOTAL label) Corresponding formatFooterRow etc. events might be needed, unless the existing ones could be reused?
- enhance the datasource table parser to extract records from the tfoot as well as the body. This could either return a separate recordset (in the meta field?) or perhaps additional records in (at
the end of?) the existing record set if there were some way to differentiate them. The datatable's constructor could then use these to initially populate the footer section.
- alternatively, a second version of the HTML parser could be created that processes just the tfoot instead of the tbody. Two datasources could then be used to process the same table, to obtain a
record set for each section. An additional constructor for the datatable could be passed both datasources (or the footer one could be optionally passed in the options).
- a way to specify (in the columns definitions, perhaps?) whether a given footer cell should be a td or a th would be useful (I usually use th for the TOTAL text and td for the corresponding value).
- ultimately, it would be nice to be able to somehow specify a footer cell should be automatically updated when the values in the column change, but that gets complicated for anything other than a
single row with a grand total. So initially it can be left for the user to do programmatically in the relevant "cell updated" event. An example of this in the docs would be useful, though.

Type: enhancement Observed in Version: 2.6.0
Component: DataTable Severity: S4 (low)
Assigned To: Jenny Donnelly Target Release: 2.9.0
Location: Library Code Priority: P3 (normal)
Tags: Relates To:
Browsers: All
Test Information:

Change History

Jenny Donnelly

YUI Developer

Posted: 06/20/09
  • milestone changed to 2.NEXT
  • status changed from new to accepted

Will definitely consider making it somewhat easier to work with footers.

Jenny Donnelly

YUI Developer

Posted: 04/12/10
  • milestone changed from 2.NEXT to 2.9.0
  • severity changed from S3 (normal) to S4 (low)

Will consider for 2.9.0, but not a high priority. AFAIK, custom code can be written to workaround any deficiencies in DataTable.

Jenny Donnelly

YUI Developer

Posted: 12/22/10
  • resolution changed to wontfix
  • status changed from accepted to closed

Will not be adding new features to 2.x, in favor of focusing development in 3.x codeline. FWIW, the features described here can be implemented with custom code.