Thursday, February 13, 2014

Don't know how to fill my datagrid from here.

Hi there,

Need advices regarding a problem adding values to a datagrid.

Project is using hibernate, requestfactory and one to many relations.
I've added a many to one relation in order to grab more datas but i am stuck dealing with the results.

In the following code, log.info is showing me that informations are correctly filled.
fiches.getHistofiches() is returning a List<HistoFichesProxy>
Everything is fine until there. 

But i am unable to fill my datagrid using driver with a List of proxy. I don't know how to proceed.
I could fire another request from histofiches but datas are already available.
Don't know where to use setRowData

May someone help ?

Regards,
Pierre

Request is fired like

       ffr.with(fichesDriver.getPaths());          ffr.to(new Receiver<FichesProxy>() {            @Override            public void onSuccess(FichesProxy fiches) {              TllogEditorWorkflow.this.fiches = fiches;              FichesRequest contextf = requestFactory.createFichesRequest();              edit(contextf);               /*  if (fiches.getHistofiches() != null) {                  for (HistoFichesProxy p : fiches.getHistofiches())                      log.info("visa : " + p.getId().getVisa() + "/ utilcre " + p.getId().getUtilcre());              }*/                TllogEditorWorkflow.this.histofiches = fiches.getHistofiches();              HistoFichesRequest contexth = requestFactory.createHistoFichesRequest();              edit(contexth);            }          }).fire();

Histofiches editor

public class HistofichesEditor extends Composite implements Editor<List<HistoFichesProxy>> {    interface Binder extends UiBinder<Widget, HistofichesEditor> {    }      interface Style extends CssResource {    }      interface TableResources extends DataGrid.Resources {      @Source(value = {DataGrid.Style.DEFAULT_CSS, "../DataGridPatch.css"})      DataGrid.Style dataGridStyle();    }    private class DossierColumn extends Column<HistoFichesProxy, String> {          public DossierColumn() {            super(new TextCell());          }            @Override          public String getValue(HistoFichesProxy object) {            return object.getId().getMetier()+object.getId().getSitegeo()+object.getId().getCptdossier()+object.getId().getNumligne().toString();          }        }    private class UtilcreColumn extends Column<HistoFichesProxy, String> {          public UtilcreColumn() {            super(new TextCell());          }            @Override          public String getValue(HistoFichesProxy object) {            return object.getId().getUtilcre();          }        }    private class DatecreColumn extends Column<HistoFichesProxy, String> {          public DatecreColumn() {            super(new TextCell());          }            @Override          public String getValue(HistoFichesProxy object) {            return object.getId().getDatecre().toString();          }        }    private class VisaColumn extends Column<HistoFichesProxy, String> {    public VisaColumn() {      super(new TextCell());    }      @Override    public String getValue(HistoFichesProxy object) {      return object.getId().getVisa().toString();    }  }    @UiField  DockLayoutPanel dock;    @UiField(provided = true)  SimplePager pager = new SimplePager();      @UiField(provided = true)    DataGrid<HistoFichesProxy> tablehisto;      public HistofichesEditor() {          tablehisto = new DataGrid<HistoFichesProxy>(15,                  GWT.<TableResources> create(TableResources.class));                  initWidget(GWT.<Binder> create(Binder.class).createAndBindUi(this));                      Column<HistoFichesProxy, String> visaColumn     =   new VisaColumn();                  Column<HistoFichesProxy, String> dossierColumn  =   new DossierColumn();                  Column<HistoFichesProxy, String> utilcreColumn  =   new UtilcreColumn();                  Column<HistoFichesProxy, String> datecreColumn  =   new DatecreColumn();                      tablehisto.addColumn(dossierColumn, "Dossier");                  tablehisto.setColumnWidth(dossierColumn, "17ex");                    tablehisto.addColumn(utilcreColumn, "Utilcre");                  tablehisto.setColumnWidth(utilcreColumn, "15ex");                    tablehisto.addColumn(datecreColumn, "Datecre");                  tablehisto.setColumnWidth(datecreColumn, "25ex");                    tablehisto.addColumn(visaColumn, "Visa");                  tablehisto.setColumnWidth(visaColumn, "25ex");        }  }


ui.xml

    <g:HTMLPanel>    <g:DockLayoutPanel ui:field="dock" unit="EX">      <g:north size="6">        <g:DockLayoutPanel unit="PCT">          <g:east size="45">            <g:SimplePanel stylePrimaryName="{style.rightAlign}">              <cv:SimplePager ui:field="pager" stylePrimaryName="{style.displayInline}" />            </g:SimplePanel>          </g:east>          </g:DockLayoutPanel>      </g:north>      <g:center>        <cv:DataGrid ui:field="tablehisto" stylePrimaryName="{style.table}" />      </g:center>    </g:DockLayoutPanel>          </g:HTMLPanel>

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment