You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Piotr Boninski <Pi...@innsoft.com.pl> on 2005/08/18 14:41:24 UTC

HtmlDataTable

Hi,

 

I'm trying to develop class inherited HtmlDataTablej with some features
which require access to displayed data. But I don't know how to deal
with raw data. Where is it ? I'm trying sth like:

 

            Iterator iter = dataTable.getChildren().iterator();

            while (iter.hasNext()) {

                UIComponent column = (UIComponent) iter.next();

                Iterator columnChildren =
column.getChildren().iterator();

                while (columnChildren.hasNext()) {

                    UIComponent child = (UIComponent)
columnChildren.next();

                    if (child instanceof HtmlOutputText) {

                        columns.add(((HtmlOutputText)
child).getValue());

                    }

                }

            }

 

But it looks like my grid is empty (definitelly, it is not). How (and
where) can I access data source kontent within data table (encodebegin,
encodeend, sth other ?)

 

Thanks

 

Piotr Boninski

 

 


Re: HtmlDataTable

Posted by Martin Marinschek <ma...@gmail.com>.
The last discussion on this on the user list ended like that:

Thanks a lot. I think that it could be something like that:

   public static List dataTableAsList(HtmlDataTable dataTable) {
       List rows = new ArrayList();
       List columns;
       for (int i = 0; i < dataTable.getRowCount(); i++) {
           dataTable.setRowIndex(i);
           columns = new ArrayList();
           Iterator iter = dataTable.getChildren().iterator();
           while (iter.hasNext()) {
               UIComponent column = (UIComponent) iter.next();
               Iterator columnChildren = column.getChildren().iterator();
               while (columnChildren.hasNext()) {
                   UIComponent child = (UIComponent) columnChildren.next();
                   if (child instanceof HtmlOutputText) {
                       columns.add(((HtmlOutputText) child).getValue());
                   }
               }
           }
           rows.add(columns);
       }
       return rows;
   }

On 8/18/05, Piotr Boninski <Pi...@innsoft.com.pl> wrote:
>  
>  
> 
> Hi, 
> 
>   
> 
> I'm trying to develop class inherited HtmlDataTablej with some features
> which require access to displayed data. But I don't know how to deal with
> raw data. Where is it ? I'm trying sth like: 
> 
>   
> 
>             Iterator iter = dataTable.getChildren().iterator(); 
> 
>             while (iter.hasNext()) { 
> 
>                 UIComponent column = (UIComponent) iter.next(); 
> 
>                 Iterator columnChildren = column.getChildren().iterator(); 
> 
>                 while (columnChildren.hasNext()) { 
> 
>                     UIComponent child = (UIComponent) columnChildren.next();
> 
>                     if (child instanceof HtmlOutputText) { 
> 
>                         columns.add(((HtmlOutputText) child).getValue()); 
> 
>                     } 
> 
>                 } 
> 
>             } 
> 
>   
> 
> But it looks like my grid is empty (definitelly, it is not). How (and where)
> can I access data source kontent within data table (encodebegin, encodeend,
> sth other ?) 
> 
>   
> 
> Thanks 
> 
>   
> 
> Piotr Boninski 
> 
>   
> 
>   


-- 

http://www.irian.at
Your JSF powerhouse - 
JSF Trainings in English and German