You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by PATRICIA GUEDES <gu...@gmail.com> on 2005/10/18 18:00:03 UTC

Question about dataTable

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

Re: Question about dataTable

Posted by PATRICIA GUEDES <gu...@gmail.com>.
Forget it!!!

I found the problem. I was constructing the valuesEmbque variable with
a Fields Array in the RemessaBean's Constructor.

Thanks any way!!!

Guedes

On 10/20/05, PATRICIA GUEDES <gu...@gmail.com> wrote:
> That's what I did. But something is wrong, because the error
> "[ServletException in:/eservices/layout/layout.jsp] null' " appears.
>
> 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, fieldsEmbque));
>      valuesEmbque.add(new RowData(this, fieldsEmbque1));
>    }
>    return valuesEmbque;
>  }
>
> public class RowData
> {
>   private RemessaBean fieldHolder;
>
>   private Fields[] fields;
>
>   public RowData(RemessaBean fieldHolder, Fields[] fields)
>   {
>     this.fieldHolder = fieldHolder;
>     this.fields = fields;
>   }
>
>   public Object getValue()
>   {
>
> System.out.println(((Fields)this.fieldHolder.getFieldsEmbque().getRowData()).getValue());
>     return fields;
>   }
>
> }
>
> Help me please!!!!
>
> Thanks.
> Guedes
>
> On 10/20/05, PATRICIA GUEDES <gu...@gmail.com> wrote:
> > 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 <mb...@googlemail.com> 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 <gu...@gmail.com>:
> > > > 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 <mb...@googlemail.com> 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 <gu...@gmail.com>:
> > > > > > 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
> > >
> >
>

Re: Question about dataTable

Posted by PATRICIA GUEDES <gu...@gmail.com>.
That's what I did. But something is wrong, because the error
"[ServletException in:/eservices/layout/layout.jsp] null' " appears.

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, fieldsEmbque));
     valuesEmbque.add(new RowData(this, fieldsEmbque1));
   }
   return valuesEmbque;
 }

public class RowData
{
  private RemessaBean fieldHolder;

  private Fields[] fields;

  public RowData(RemessaBean fieldHolder, Fields[] fields)
  {
    this.fieldHolder = fieldHolder;
    this.fields = fields;
  }

  public Object getValue()
  {
    System.out.println(((Fields)this.fieldHolder.getFieldsEmbque().getRowData()).getValue());
    return fields;
  }

}

Help me please!!!!

Thanks.
Guedes

On 10/20/05, PATRICIA GUEDES <gu...@gmail.com> wrote:
> 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 <mb...@googlemail.com> 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 <gu...@gmail.com>:
> > > 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 <mb...@googlemail.com> 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 <gu...@gmail.com>:
> > > > > 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
> >
>

Re: Question about dataTable

Posted by PATRICIA GUEDES <gu...@gmail.com>.
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 <mb...@googlemail.com> 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 <gu...@gmail.com>:
> > 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 <mb...@googlemail.com> 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 <gu...@gmail.com>:
> > > > 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
>

Re: Question about dataTable

Posted by Mathias Brökelmann <mb...@googlemail.com>.
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 <gu...@gmail.com>:
> 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 <mb...@googlemail.com> 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 <gu...@gmail.com>:
> > > 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

Re: Question about dataTable

Posted by PATRICIA GUEDES <gu...@gmail.com>.
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 <mb...@googlemail.com> 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 <gu...@gmail.com>:
> > 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
>

Re: Question about dataTable

Posted by Mathias Brökelmann <mb...@googlemail.com>.
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 <gu...@gmail.com>:
> 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