1. #1
    Ext User
    Join Date
    Feb 2010
    Posts
    19
    Vote Rating
    0
    titobundy is on a distinguished road

      0  

    Question Update Grid with RpcProxy

    Update Grid with RpcProxy


    Hi.

    I have a grid as in this example:

    http://www.extjs.com/examples/#pagingbeanmodelgrid

    I also have a form that I filtered these results, but I don't know how to do this with RpcProxy. I need something as:

    Button btnFilter = new Button("Apply filter");
    btnFilter.addSelectionListener(new SelectionListener<ButtonEvent>() {

    @Override
    public void componentSelected(ButtonEvent ce) {
    updateListGrid(filter1, filter2,...);
    }
    }
    );
    ...
    ...
    ...

    public void updateListGrid(String filter1, String filter2,...)
    {
    ....
    // Apply filter to the grid calling a new rpc services for example
    service.getListSP(filter1, filter2, (PagingLoadConfig) loadConfig, callback);
    }

  2. #2
    Ext User
    Join Date
    Feb 2010
    Posts
    19
    Vote Rating
    0
    titobundy is on a distinguished road

      0  

    Talking


    Hi.

    I solved the problem:

    The RpcProxy:

    Code:
           proxyP = new RpcProxy<PagingLoadResult<SolicitudPedido>>() {
    
                @Override
                protected void load(Object loadConfig,
                        AsyncCallback<PagingLoadResult<SolicitudPedido>> callback) {
                    PagingLoadConfig filtro = (PagingLoadConfig)  loadConfig;
                    try
                    {
                        if(filtro.get("filtro")!=null)
                            solicitudService.buscarSolicitudPedido((BusquedaSolicitudPedido) filtro.get("filtro"), filtro, callback);
                        else                    
                            solicitudService.getListadoSP((PagingLoadConfig) loadConfig, callback);                        
                    }catch(Exception e)
                    {
                        Info.display("Error", e.getMessage());
                    }
                    
                
                }            
            };
    The update method

    Code:
        public void updateListGrid(final BusquedaSolicitudPedido filtro)
        {
            PagingLoadConfig config = new BasePagingLoadConfig();
            config.setOffset(0);
            config.setLimit(2);
            config.set("filtro", filtro);
            
            loaderP.load(config);
        }