I have something like:

.......
@Override
    public void requestRows(final Request request, final
Callback<CondominioTipoBModel> callback) {

        listadoUnidadesVendiles = new ArrayList<CondominioTipoBModel>
();
        cachedTableModel.clearCache();

        FacadeUnidadesVendiblesAsync call =
ServiceLocator.getFacadeUnidadesVendibles();
        call.listadoUnidadesVendiblesCondominioTipoB(321, 2, new
AsyncCallback<List<CondominioTipoBTo>> () {

            public void onFailure(Throwable caught) {
                GWT.log(caught.getMessage(), null);
            }

            public void onSuccess(List<CondominioTipoBTo> listado) {

                int registrosIngresados = 0;
                for (CondominioTipoBTo e : listado) {

                    CondominioTipoBModel c = new CondominioTipoBModel
();

                    ObrasComplementariasModel o = new
ObrasComplementariasModel();

                    o.setSuperficiePavimentoCalidadDos
( e.getObrasComplementarias().getSuperficiePavimentoCalidadDos() );
                    o.setSuperficiePavimentoCalidadUno
( e.getObrasComplementarias().getSuperficiePavimentoCalidadUno() );
                    o.setTechumbreAcero( e.getObrasComplementarias
().getTechumbreAcero() );
                    o.setTechumbreMadera( e.getObrasComplementarias
().getTechumbreMadera() );
                    o.setTechumbreMaderaLaminada
( e.getObrasComplementarias().getTechumbreMaderaLaminada() );
                    o.setSuperficiePavimentos
( e.getObrasComplementarias().getSuperficieCalidadPavimentos() );
                    o.setSuperficieTechumbres
( e.getObrasComplementarias().getSuperficieTechumbres() );

                    GWT.log( e.getObrasComplementarias
().getSuperficieTechumbres()+" -- "+e.getObrasComplementarias
().getSuperficieTechumbres() , null);

                    TerrenoModel t = new TerrenoModel();
                    t.setFrente( e.getTerreno().getFrente() );
                    t.setFondo( e.getTerreno().getFondo() );
                    t.setSuperficie( e.getTerreno().getSuperficie() );

                    ConstruccionModel m = new ConstruccionModel();
                    m.setSuperficieLineaConstruccion( e.getConstruccion
().getSuperficieLineaConstruccion() );

                    c.setDireccion(e.getDireccion());
                    c.setManzana(e.getManzana());
                    c.setLote(e.getLote());
                    c.setDestino(e.getDestino());
                    c.setBcpAsociado(e.getBcpAsociado().trim());

                    c.setTerreno(t);
                    c.setObrasComplementarias(o);
                    c.setConstruccion(m);

                    listadoUnidadesVendiles.add(c);
                    registrosIngresados ++;
                  }

                int porCompletar = cantidadUnidades -
registrosIngresados;
                for (int i = 0; i < porCompletar; i++) {

                    CondominioTipoBModel temp = new
CondominioTipoBModel();
                    ObrasComplementariasModel o = new
ObrasComplementariasModel();
                    TerrenoModel t = new TerrenoModel();
                    ConstruccionModel m = new ConstruccionModel();
                    temp.setObrasComplementarias(o);
                    temp.setTerreno(t);
                    temp.setConstruccion(m);
                    listadoUnidadesVendiles.add(temp);

                }

                cachedTableModel.setRowCount
(listadoUnidadesVendiles.size());
                SerializableResponse<CondominioTipoBModel> response =
new SerializableResponse<CondominioTipoBModel>
(listadoUnidadesVendiles);
                callback.onRowsReady(request, response);
            }});

    }

.....
    public CachedTableModel<CondominioTipoBModel>
crearCachedTableModel () {
        cachedTableModel = new CachedTableModel<CondominioTipoBModel>
(this);
        return cachedTableModel;
    }

.......

i hope help you !

On 4 nov, 08:35, Andrius Juozapaitis <[email protected]> wrote:
> Hey,
>
> I was playing around with incubator's PagingScrollTable for a while,
> and I've come across an issue there. I have a DataSourceTableModel
> that extends MutableTableModel, and looks like this:
>
> public class DataSourceTableModel extends MutableTableModel {
> ...
>     @Override
>     public void requestRows(final TableModelHelper.Request request,
> final Callback callback) {
>         UserService.App.getInstance().getUsers(new
> AsyncCallback<ViewResult<User>>() {
>             @Override
>             public void onFailure(Throwable throwable) {
>                 Window.alert("failed retrieving the users" +
> throwable);
>             }
>
>             @Override
>             public void onSuccess(final ViewResult<User>
> userViewResult) {
>                 Window.alert("received rows: " +
> userViewResult.getTotalRows());
>
>                 // Application.cachedTableModel.setRowCount
> (userViewResult.getTotalRows());
>
>                 callback.onRowsReady(request, new
> TableModelHelper.Response() {
>                     @Override
>                     public Iterator getRowValues() {
>                         final Iterator<ValueRow<User>> rows =
> userViewResult.getRows().iterator();
>                         return new Iterator(){
>
>                             @Override
>                             public boolean hasNext() {
>                                 return rows.hasNext();
>                             }
>
>                             @Override
>                             public Object next() {
>                                 return rows.next().getValue();
>                             }
>
>                             @Override
>                             public void remove() {
>
>                             }
>                         };
>                     }
>                 });
>             }
>         });
>     }
>
> }
>
> It is then wrapped around in a CachedTableModel:
>
> CachedTableModel<User> cachedTableModel = new CachedTableModel<User>
> (tableModel);
>
> Now, cachedTableModel actually holds a reference to the
> DataSourceTableModel. When retrieving the data using
> DataSourceTableModel.requestRows(,,,)  method, I get back a number of
> total rows in the result set, and would like to update the paging
> control accordingly. The problem is, if I invoke setRowCount
> (userViewResult.getTotalRows())) in this method,it only updates the
> underlying DataSourceTableModel, not the cachedTableModel, which is
> actually used by the PagingScrollTable.
>
> A RowCountChangeEvent event is fired when invoking setRowCount() on a
> DataSourceTableModel, but I can't register a listener on
> CachedTableModel for it, because CachedTableModel.setRowCount() looks
> like
>
>   public void setRowCount(int rowCount) {
>     tableModel.setRowCount(rowCount);
>     super.setRowCount(rowCount);
>   }
>
> so it would in turn invoke DataSourceTableModel's setRowCount, and go
> into an infinite loop, as it fires another event.
>
> Am I missing something here? Are there any other ways to achieve this
> functionality without holding a back reference to a CachedTableModel
> inside a DataSourceTableModel?
>
> regards,
> Andrius Juozapaitis
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to