Title: Melding
Hi all,
 
I just finished a patch to displaytag that had two objectives:
 - Include functionality that lets me highlight a row where the user has clicked on a link in a row.
 - Add displaytag code regarding to usage of stylesheet, so that the <TR> and <TD> tags output by displaytag includes the styleclass.
   This makes it possible to change cell attributes like font,text color etc of the text displayed in each cell according to the styleheet of 'odd', 'even' and 'selectedRow'.
   Previously you could not set the style of the text in a cell, which quite heavily limited the color difference you could use in the 'even' and 'odd' style classes,
   and even more importantly in the new 'selectedRow' styleclass which is supposed to stand out from the 'odd' and 'even' styles.
 
Because of me having limited time available to complete this, I added the new functionality as a patch to the 'decorator' tag parameter.
The change is backwards compatible, so that it doesn't break existing code - and you can still use this parameter to specify a decorator.
But the tag parameter now accepts a comma-separated input that lets you specify either one of these combinations:
 - decorator="org.yourorg.decorator.YourDecorator" if you want to use the param as before.....
 - decorator="highlightSelectedRow,drilldownByAccountId" if you want to higlight a row that contains a link that the user clicks
   (that contains the request parameter 'drilldownByAccountId') without using a decorator.
 - decorator="org.yourorg.decorator.YourDecorator,requestParameterToUseForHighlighting if you want to use BOTH a decorator and row highlighting.
 
My implementation matches the request parameter value, e.g 'drilldownByAccountId=10023' with the request parameter values found in each column of the table.
If a match is found, the CSS style class of <TR> and <TD> tags of this row is set to 'selectedRow'
 
Current implementation limitations and wanted future functionality/implementation:
 - If more than one row has a link with the same request paramater + value, only the first occurence is marked as a 'selectedRow'
 - The current implementation can only handle request parameter matching for one column at the time,
    but it should be fairly easy to expand this - now it meets MY, needs so I stopped there....
 - This functionality should probably rather have it's own parameter, instead of patching the decorator="xx" parameter.
 
Apart from that: have fun playing with row highlighting ;-)
(patches included: Row.java, Column.java, TableTag.java)
 
 
Knut Erik Ballestad

Attachment: Column.patch
Description: Binary data

Attachment: Row.patch
Description: Binary data

Attachment: TableTag.patch
Description: Binary data

Reply via email to