[Dojo-interest] (Unofficial) FilteringTable enhancements
Tom Trenka
dojo-interest at dept-z.com
Wed Jan 17 10:40:48 MST 2007
Numeric formatting is a current ticket filed against me; I was waiting for
some of the i8ln code to land so that I can take advantage of things like
that for currency formatting purposes.
trt
_Pierre_ wrote:
>
> Can you post a full example ?
> Cause when I replace my filteringtable.js with the patched one the NaN
> values are still visible.
> And an Example HowTo for distinct rendering functionality would be handy
> also.
> I have a Currency Field that I want to have ex: 1000 € instead of
> 1000 Is this possible with the distinct rendering functionality ?
> Will these Patches go into Upstream ?
>
> Thanks for your work !
>
>
> Ross Thomas wrote:
>>
>> While 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 <TD> 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:
>>
>> <TH .... renderUsing="myRenderFunc" ...>...</TH>
>>
>> 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-tf3023551.html#a8415098
Sent from the Dojo mailing list archive at Nabble.com.
More information about the Dojo-interest
mailing list