Hi, again!! I have a new question now. I am using the STATE_SAVING_METHOD = 'client' and when I try to use the dataTable's preserveRows property, appears a error "Error while saving state in 'client' of type RowData". My real problem is that I want to work with the dataModel adding and deleting lines in a table. In the first time works, but in the next, my dataModel variable becames null and appear a NullPointerException.
Any ideas? Thanks Guedes On 10/21/05, PATRICIA GUEDES <[EMAIL PROTECTED]> wrote: > It works!!!! Finally... > > Thanks very much for your time and patience . > > Guedes > > On 10/21/05, Mathias Brökelmann <[EMAIL PROTECTED]> wrote: > > sorry I forgot to answer your question. > > > > You should not initialize your RowData with a datamodel for your > > fields as a second parameter. Instead pass the values for each field > > of this row and don´t put your values into your fields: > > > > private static final Fields[] fieldsEmbque = new Fields[] { > > new Fields(1, "Embarcador", "NUMBER", true, true, "", > > equipaments, "COMBO"), > > new Fields(2, "Nº Embarque", "NUMBER", true, true, "", null, null), > > new Fields(3, "Dt. Prevista", "DATE", true, false, "", null, null), > > new Fields(4, "Pedido", "NUMBER", true, false, "", null, null), > > new Fields(5, "Cliente", "NUMBER", true, false, "", null, null), > > new Fields(6, "Local Embarque", "STRING", true, false, "", null, > null), > > new Fields(7, "Lote", "NUMBER", true, false, "", null, null)}; > > > > public List getValuesEmbque() { > > if(valuesEmbque == null) { > > valuesEmbque = new ArrayList(); > > valuesEmbque.add(new RowData(this, new String[] > > {"1","2","3","4","5","6","7"}); > > valuesEmbque.add(new RowData(this, new String[] > > {"8","9","10","11","12","13","14"}); > > } > > return valuesEmbque; > > } > > > > public class RowData > > { > > private RemessaBean fieldHolder; > > > > private String values; > > > > public RowData(RemessaBean fieldHolder, String[] values) > > { > > this.fieldHolder = fieldHolder; > > this.values = values; > > } > > > > public Object getValue() > > { > > return this.values[this.fieldHolder.getRowIndex()]; > > } > > > > } > > > > <x:dataTable value="#{remessaBean.valuesEmbque}" var="values"> > > <x:columns value="#{remessaBean.fieldsEmbque}" var="field"> > > <f:facet name="header"> > > <x:outputText value="#{field.nomeCampoTela}"/> > > </f:facet> > > <x:selectOneMenu value="#{values.value}" > > rendered='#{field.active and field.tipoHTML=="COMBO"}'> > > <f:selectItems value="#{field.itensHTML}"/> > > </x:selectOneMenu> > > <h:outputText value="#{values.value}" > > rendered='#{field.active and field.tipoHTML!="COMBO"}'/> > > </x:columns> > > </x:dataTable> > > > > this should work. > > > > > > 2005/10/21, PATRICIA GUEDES <[EMAIL PROTECTED]>: > > > Anyone help me, please!!!! > > > > > > I don't know what do .... > > > > > > Thanks > > > Guedes > > > > > > On 10/20/05, PATRICIA GUEDES <[EMAIL PROTECTED]> wrote: > > > > Hi, (sorry for my bad english again) > > > > > > > > I am trying to create a table using dataTable, but something is > wrong. > > > > When I try to show my lines using a DataModel, just the first element > > > > of each Array was showed. > > > > > > > > Ex what I want: > > > > > > > > 1 2 3 4 5 6 7 > > > > 8 9 10 11 12 13 14 > > > > > > > > How is been showed ... > > > > > > > > 1 1 1 1 1 1 1 > > > > 8 8 8 8 8 8 8 > > > > > > > > My code : > > > > > > > > ****************************** RemessaBean class > > > > > > > > private static final Fields[] fieldsEmbque = new Fields[] { > > > > new Fields(1, "Embarcador", "1", "NUMBER", true, true, "", > > > > equipaments, "COMBO"), > > > > new Fields(2, "Nº Embarque", "2", "NUMBER", true, true, "", null, > > > > null), > > > > new Fields(3, "Dt. Prevista", "3", "DATE", true, false, "", null, > > > > null), > > > > new Fields(4, "Pedido", "4", "NUMBER", true, false, "", null, > > null), > > > > new Fields(5, "Cliente", "5", "NUMBER", true, false, "", null, > > null), > > > > new Fields(6, "Local Embarque", "6", "STRING", true, false, "", > > null, > > > > null), > > > > new Fields(7, "Lote", "7", "NUMBER", true, false, "", null, > null)}; > > > > > > > > private static final Fields[] fieldsEmbque1 = new Fields[] { > > > > new Fields(1, "Embarcador", "8", "NUMBER", true, true, "", > > > > logProviders, "COMBO"), > > > > new Fields(2, "Nº Embarque", "9", "NUMBER", true, true, "", null, > > > > null), > > > > new Fields(3, "Dt. Prevista", "10", "DATE", true, false, "", > null, > > > > null), > > > > new Fields(4, "Pedido", "11", "NUMBER", true, false, "", null, > > null), > > > > new Fields(5, "Cliente", "12", "NUMBER", true, false, "", null, > > null), > > > > new Fields(6, "Local Embarque", "13", "STRING", true, false, "", > > > > null, null), > > > > new Fields(7, "Lote", "14", "NUMBER", true, false, "", null, > > null)}; > > > > > > > > > > > > public List getValuesEmbque() { > > > > if(valuesEmbque == null) { > > > > valuesEmbque = new ArrayList(); > > > > valuesEmbque.add(new RowData(this, new > > ArrayDataModel(fieldsEmbque))); > > > > valuesEmbque.add(new RowData(this, new > > > > ArrayDataModel(fieldsEmbque1))); > > > > } > > > > return valuesEmbque; > > > > } > > > > > > > > *********************************************** RowData Class > > > > > > > > public class RowData > > > > { > > > > private RemessaBean fieldHolder; > > > > > > > > private ArrayDataModel fields; > > > > > > > > public RowData(RemessaBean fieldHolder, ArrayDataModel fields) > > > > { > > > > this.fieldHolder = fieldHolder; > > > > this.fields = fields; > > > > } > > > > > > > > public Object getValue() > > > > { > > > > //return > > > > > > > ((Fields)((ArrayDataModel)this.fieldHolder.getValueEmbque().getRowData()).getRowData()).getValue(); > > > > > > > > return ((Fields)fields.getRowData()).getValue(); > > > > } > > > > > > > > } > > > > > > > > **************************************** JSF page > > > > > > > > <x:dataTable value="#{remessaBean.valuesEmbque}" var="values" > > width="760" > > > > cellpadding="0" cellspacing="1" > > > > rowClasses="inputFields" headerClass="fields"> > > > > <x:columns value="#{remessaBean.fieldsEmbque}" var="field" > > > > styleClass="forms" style="text-align:center" > > > > > <f:facet name="header"> > > > > <x:outputText value="#{field.nomeCampoTela}" > > > > styleClass="forms"/> > > > > </f:facet> > > > > <x:selectOneMenu value="#{field.value}" > > > > rendered='#{field.active and field.tipoHTML=="COMBO"}'> > > > > <f:selectItems value="#{field.itensHTML}"/> > > > > </x:selectOneMenu> > > > > <h:outputText value="#{values.value}" > > > > rendered='#{field.active and field.tipoHTML!="COMBO"}'/> > > > > </x:columns> > > > > </x:dataTable> > > > > > > > > Any ideas? > > > > > > > > Guedes > > > > > > > > > > > > > -- > > Mathias > > >