Sorry, but I don't understand (I am learning yet). How can I fill the
row data? With an Array?

Thanks,
Guedes

On 10/18/05, Mathias Brökelmann <[EMAIL PROTECTED]> wrote:
> try to use an instance of DataModel as the value for either
> valuesEmbque or fieldsEmbque. You can then determine with
> DataModel.getRowData() the current value of the List to determine
> which value you should return for each cell:
>
> public class RemessaBean
> {
>   private DataModel fieldsEmbqueModel;
>   private List valuesEmbque;
>
>   public DataModel getFieldsEmbque()
>   {
>     if(fieldsEmbqueModel == null)
>     {
>       fieldsEmbqueModel = new ArrayDataModel(fieldsEmbque)
>     }
>     return fieldsEmbqueModel;
>   }
>
>   public List getValuesEmbque()
>   {
>     if(_valuesEmbque == null)
>     {
>       _valuesEmbque = new ArrayList();
>       _valuesEmbque.add(new RowData(this, .....));
>       _valuesEmbque.add(new RowData(this, .....));
>     }
>     return _valuesEmbque;
>   }
> }
>
> public class RowData
> {
>   private RemessaBean _fieldHolder;
>
>   public RowData(RemessaBean fieldHolder, .....)
>   {
>     _fieldHolder = fieldHolder;
>     // fill your row data
>     ...
>   }
>
>   public Object getValue()
>   {
>      Field field = (Field)_fieldHolder.getFieldsEmbque().getRowData()
>      // use field to determine which value should be returned.
>      ....
>   }
>
> <x:dataTable value="#{remessaBean.valuesEmbque}" var="values" width="760"
>                 cellpadding="0" cellspacing="1">
>        <x:columns value="#{remessaBean.fieldsEmbque}" var="field">
>            <f:facet name="header">
>                <x:outputText value="#{field.nomeCampoTela}"
> styleClass="forms"/>
>            </f:facet>
>            <h:outputText value="#{values.value}" styleClass="forms"/>
>        </x:columns>
>    </x:dataTable>
>
>
> 2005/10/18, PATRICIA GUEDES <[EMAIL PROTECTED]>:
> > Thanks for your reply! That's exactly what I needed. But, now I have
> > another problem. How can I reference an Object's attribute in a
> > ArrayList? Follow a simple example (very ugly) :
> >
> > <x:dataTable value="#{remessaBean.valuesEmbque}" var="values" width="760"
> >                  cellpadding="0" cellspacing="1">
> >         <x:columns value="#{remessaBean.fieldsEmbque}" var="field">
> >             <f:facet name="header">
> >                 <x:outputText value="#{field.nomeCampoTela}"
> > styleClass="forms"/>
> >             </f:facet>
> >             <h:outputText value="#{values.Fields.value}"
> styleClass="forms"/>
> >         </x:columns>
> >     </x:dataTable>
> >
> >
> > private static final Fields[] fieldsEmbque = new Fields[] {
> >     new Fields(1, "Embarcador", "1", "NUMBER", true, true, "", null),
> >     new Fields(2, "Nº Embarque", "2", "NUMBER", true, true, "", null),
> >     new Fields(3, "Dt. Prevista", "3", "DATE", true, false, "", null),
> >     new Fields(4, "Pedido", "4", "NUMBER", true, false, "", null),
> >     new Fields(5, "Cliente", "5", "NUMBER", true, false, "", null),
> >     new Fields(6, "Local Embarque", "6", "STRING", true, false, "",
> null),
> >     new Fields(7, "Lote", "7", "NUMBER", true, false, "", null)};
> >
> >   private static final Fields[] fieldsEmbque1 = new Fields[] {
> >     new Fields(1, "Embarcador", "8", "NUMBER", true, true, "", null),
> >     new Fields(2, "Nº Embarque", "9", "NUMBER", true, true, "", null),
> >     new Fields(3, "Dt. Prevista", "10", "DATE", true, false, "", null),
> >     new Fields(4, "Pedido", "11", "NUMBER", true, false, "", null),
> >     new Fields(5, "Cliente", "12", "NUMBER", true, false, "", null),
> >     new Fields(6, "Local Embarque", "13", "STRING", true, false, "",
> null),
> >     new Fields(7, "Lote", "14", "NUMBER", true, false, "", null)};
> >
> >   private List valuesEmbque;
> >
> >   public RemessaBean () {
> >       valuesEmbque = new ArrayList();
> >       valuesEmbque.add(fieldsEmbque);
> >       valuesEmbque.add(fieldsEmbque1);
> >   }
> >
> > My problem is the part "values.Fields.value" that didn't work. What can I
> do?
> >
> > Thanks.
> > Guedes
> >
> >
> >
> > On 10/18/05, Mathias Brökelmann <[EMAIL PROTECTED]> wrote:
> > > try out the t:columns component which allows you to have NxM tables.
> > > Take a look into the myfaces-examples (opendatatable)
> > >
> > > 2005/10/18, PATRICIA GUEDES <[EMAIL PROTECTED]>:
> > > > Hi, I´m from Brazil (sorry my bad English)  and I need to build a
> > > > table where the columns are dynamics. The columns came from a
> > > > ArrayList of "fields" and the lines came from each field's values.
> How
> > > > can I do that?
> > > >
> > > > Ex:
> > > >
> > > > field1   field2   field3   field4   field5     (colunas vêm de um
> > > > ArrayList de fields)
> > > >    1         2         3         4        5
> > > >    6         7         8         9        10
> > > >
> > > > Any ideas?
> > > >
> > > > Thanks.
> > > > Guedes
> > > >
> > >
> > >
> > > --
> > > Mathias
> > >
> >
>
>
> --
> Mathias
>

Reply via email to