[ 
https://issues.apache.org/jira/browse/TOMAHAWK-912?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Paul Palaszewski updated TOMAHAWK-912:
--------------------------------------

    Status: Patch Available  (was: Open)

> HtmlDataTable's column groupBy should work with HtmlCommandLinks ...
> --------------------------------------------------------------------
>
>                 Key: TOMAHAWK-912
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-912
>             Project: MyFaces Tomahawk
>          Issue Type: Improvement
>          Components: Extended Datatable
>    Affects Versions: 1.1.3, 1.1.5-SNAPSHOT
>            Reporter: Paul Palaszewski
>
> Hi!
> I'm using the extended data table with groupBy which works fine for 
> outputText (any ValueHolder derived from UIOutput), but it ignores 
> commandLinks, which is anoying if the column's value is only displayed as 
> link.
> I've checked versions 1.1.3 and 1.1.5 snapshot ... imho, the issue is in 
> HtmlTableRenderer#createColumnInfos somewhere around line 286 which looks 
> like ..
>                     UIComponent currentColumnChild = (UIComponent) 
> currentColumnChildren.get(j);
>                     if (currentColumnChild.isRendered() && currentColumnChild 
> instanceof ValueHolder)
>                     {
>                         Object value = ((ValueHolder) 
> currentColumnChild).getValue();
>                         if (value != null) {
>                             Converter converter =
>                                 
> HtmlRendererUtils.findUIOutputConverterFailSafe(facesContext, 
> currentColumnChild);
>                             currentColumnContent.append(
>                                 
> RendererUtils.getConvertedStringValue(facesContext, currentColumnChild,
>                                                                       
> converter, value)); // TODO converter
>                         }
>                     }
> HtmlCommandLinks are UICommands and not UIOutputs which implement 
> ValueHolder. To fix this, I tried to patch HtmlCommandLink to implement 
> ValueHolder, but this results in a class cast exception since some part of 
> #findUIOutputConverterFailSafe tries to cast the component as UIOutput. So 
> I've added another instance of, which works fine for me:
>                     UIComponent currentColumnChild = (UIComponent) 
> currentColumnChildren.get(j);
>                     if (currentColumnChild.isRendered()) {
>                         if (currentColumnChild instanceof ValueHolder)
>                         {
>                             Object value = ((ValueHolder) 
> currentColumnChild).getValue();
>                             if (value != null) {
>                                 Converter converter =
>                                     
> HtmlRendererUtils.findUIOutputConverterFailSafe(facesContext, 
> currentColumnChild);
>                                 currentColumnContent.append(
>                                     
> RendererUtils.getConvertedStringValue(facesContext, currentColumnChild,
>                                                                           
> converter, value)); // TODO converter
>                             }
>                         } else if (currentColumnChild instanceof UICommand) {
>                             Object value = ((UICommand) 
> currentColumnChild).getValue();
>                             if (value != null) {
>                                 currentColumnContent.append(value);
>                             }
>                         }
>                     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to