enhancement
(Unofficial) FilteringTable enhancements
Posted June 20th, 2007 by mailarchiveWhile I await the new Dojo CLA text I am making the following
unofficial enhancements to the FilteringTable available. I have seen
several cases in the list recently that would have benfited from these
capabilities.
Attached are three patches that cover two enhancements to FilteringTable.
The two enehancements are:
1) Distinct rendering functionality.
====================================
This allows for the specification of a function that provides rendering of
the column's value in a way analogous to the 'sortUsing/sortFunction'
capability. Thus a Number like '100.0' which currently can only be rendered
as '100' could be rendered as '100.00' in blue text as a link and still be
sortable by the table since it is still represented as a Number in the data
store.
In a similar vein, a boolean value could be represented as a CheckBox
with the 'selected' attribute set according to the current value of the
data. Thus by updating the value in the data store, the checkbox will
change accordingly.
The render function is called as:
function(cell, meta, val, src)
where:
cell is the element for the current value
meta is the column description data (aka table.columns[index])
val is the actual value from the data store
src is the original JSON data (or parsed HTML data) for the row
The presence of 'src' allows for rendering based on other values in the row.
The return value of the function is a string suitable for insertion as the
'innerHTML' value of the cell.
To specify the render function use either the HTML tag method:
...
or the programmatic method in the column spec:
var myColumn = {
....
renderFunction: myRenderFunc,
....
};
table.columns.push(table.createMetaData(myColumn));
2) Benign handling of 'null' data.
==================================
This patch allows for null values to be treated as minimal values in a sort
and also to have them displayed as empty cells by the default rendering
engine.
Thus a Date column with a null value will not display as "01/01/70" or
"NaN/NaN/NaN". Instead it will display as an empty cell.
In an ascending sort all null values will be at the top of the cloumn.
Similarly, for a descending sort all null values will be at the bottom.
Contents
========
The attached zip file provides patches and source files for the two
functionalities distinctly and combined. These patches and files are
relative to the 0.4.1 release.
A patch for the nightly builds can be provided as needed/requested.
Hope this helps others as much as it has helped me.
Ross.
Attachment: http://www.nabble.com/file/5673/FilteringTable.zip
FilteringTable.zip
--
View this message in context: http://www.nabble.com/%28Unofficial%29-FilteringTable-enhancements-tf302...
Sent from the Dojo mailing list archive at Nabble.com.
Dojo Forum