Hi Pawel,

ya you got me right, thx your solution works fine. But I have another problem: If I create for example 4 new datasets and add them to the ArrayList, I get in my result Table 4 lines that's correct,
but only the name of the last added dataset is shown (so 4 times).

Do you know why?

Cheers Wolfgang

Hi,
I'm not sure if I get you right, but it seems to me you would like to achieve this:

 <t:dataTable id="results"
             border="1"
             value="#{proteins.list}"
             var="line"
                  *rowIndexVar="idx"*
             renderedIfEmpty="false"
             styleClass="contenttable"
             headerClass="contenttable"
             cellspacing="0" cellpadding="3">

     <h:column>
         <f:facet name="header">
             <h:outputText value="Index"/>
         </f:facet>
         <h:outputText value="*#{idx+1}*"/>
     </h:column>

     <h:column>
         <f:facet name="header">
             <h:outputText value="Name"/>
         </f:facet>
         <h:outputText value="#{line.name}"/>
     </h:column
</t:dataTable>

In this way you don't need to implement any counter by yourself, so you can get rid of setIndex() and getIndex() methods ..

--
Regards
Paweł Czerwiński
[EMAIL PROTECTED]



"Wolfgang Kluge" <[EMAIL PROTECTED]> wrote on 2007-09-05 13:36:21:

> Hi,
>
> I would like to have a column called index, which shows the number
> of lines in the table.
> Furthermore the dynamic table seems to work, but only
> the last entry is displayed in all lines in the table.
>
> xhtml:
> <t:dataTable id="results"
>                         border="1"
>                         value="#{proteins.list}"
>                         var="line"
>                         renderedIfEmpty="false"
>                         styleClass="contenttable"
>                         headerClass="contenttable"
>                         cellspacing="0" cellpadding="3">
>
>                <h:column>
>                    <f:facet name="header">
>                    <h:outputText value="Index"/>
>                    </f:facet>
>                    <h:outputText value="#{proteins.index}"/>
>                </h:column>
>
>
>                <h:column>
>                    <f:facet name="header">
>                    <h:outputText value="Name"/>
>                    </f:facet>
>
>                    <h:outputText value="#{line.name}"/>
>                </h:column
>
>            </t:dataTable>
>
>
> Bean:
> public class Proteins {
>
>    private int index=0;
>
>    private List list = new ArrayList();
>
>    /** Creates a new instance of StudentBean */
>    public Proteins() {
>
>        Dataset set = new Dataset();
>
>        set.setName("Dataset 1");
>        set.setInput("This is Dataset 1");
>        list.add(set);
>
>        set.setName("Dataset 2");
>        set.setInput("This is Dataset 2");
>        list.add(set);
>    }
>
>    public List getList() {
>        return list;
>    }
>
>    public void setList(List list) {
>        this.list = list;
>    }
>
>    public int getIndex() {
>        return index;
>    }
>
>    public void setIndex(int index) {
>        this.index = index;
>    }
> }
>
>
> Do anyone know how to get this working?
>
> Cheers Wolfgang
>
>
> --
> Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten
> Browser-Versionen downloaden: http://www.gmx.net/de/go/browser

Reply via email to