1. #1
    Sencha Premium Member
    Join Date
    Jul 2008
    Posts
    17
    Vote Rating
    0
    winter is on a distinguished road

      0  

    Default Unanswered: RequestFactory Paging Combo - ToolBar binding (RC2)

    Unanswered: RequestFactory Paging Combo - ToolBar binding (RC2)


    I based myself on the examples of requestfactory grid and the advanced combobox. Everything works as expected only the toolBar is not functional as it doesn't display the total number of items & current page. Did I miss something ?

    Code:
    final ListStore<ItemProxy> itemStore = new ListStore<ItemProxy>(itemProps.id());       
     final ComboBox itemCombo = new ComboBox<ItemProxy>(itemStore, itemProps.description());
            itemCombo.setSelectOnFocus(true);
            
            RequestFactoryProxy<PagingLoadConfig, PagingLoadResult<ItemProxy>> loadRequestFactoryProxy = new RequestFactoryProxy<PagingLoadConfig, PagingLoadResult<ItemProxy>>() {
                @Override
                public void load(PagingLoadConfig loadConfig, Receiver<? super PagingLoadResult<ItemProxy>> receiver) {
                    cf.getRequestFactory().itemRequest().findAll(itemCombo.getText(),loadConfig.getOffset(),loadConfig.getLimit()).with("data.category").to(receiver).fire();
                }
            };
    
    
            PagingLoader<PagingLoadConfig,PagingLoadResult<ItemProxy>> loader = new PagingLoader<PagingLoadConfig,PagingLoadResult<ItemProxy>>(loadRequestFactoryProxy);
    
    
            loader.addLoadHandler(new LoadResultListStoreBinding<PagingLoadConfig, ItemProxy, PagingLoadResult<ItemProxy>>(itemStore));
    
    
            itemCombo.setPageSize(10);
            itemCombo.setLoader(loader);
            itemCombo.setTriggerAction(ComboBoxCell.TriggerAction.ALL);
            itemCombo.setForceSelection(true);
            return itemCombo;

    Code:
    @ProxyFor(value =  ItemPagingLoadResult.class)
    public interface ItemPagingLoadResultProxy extends ValueProxy, PagingLoadResult<ItemProxy> {
    
    
        @Override
        List<ItemProxy> getData();
    
    
        @Override
        int getOffset();
    
    
        @Override
        int getTotalLength();
    
    
        @Override
        void setOffset(int i);
    
    
        @Override
        void setTotalLength(int i);
    }
    Code:
    @Service(value = ItemDao.class, locator = DaoLocator.class)    public interface ItemRequestContext extends RequestContext {
    
            Request<ItemPagingLoadResultProxy> findAll(String partial,int offset,int limit);
    
        }
    Server side:

    Code:
    public class ItemPagingLoadResult extends PagingLoadResultBean<Item> {
    
        protected ItemPagingLoadResult() {
            super();
        }
    
    
        public ItemPagingLoadResult(List<Item> items, int totalLength, int offset) {
            super(items, totalLength, offset);
        }
    }
    Code:
    @Component("itemDao")public class ItemDaoImpl extends BaseDaoImpl<Item> implements ItemDao {
    
    
        public ItemDaoImpl() {
            super(Item.class);
        }
    
    
        @Override
        public List<Item> findCategoryItems(Long categoryId) {
            return getHibernateTemplate().find("from " + type.getSimpleName() + " where category.id = ?", categoryId);
        }
    
    
        @Override
        public ItemPagingLoadResult findAll(String partial,int offset,int limit) {
            String likeDescription = "%"+partial.toUpperCase()+"%";
            List<Item> items = getHibernateTemplate().findByNamedQueryAndNamedParam("findPagingLoadItems",new String[]{"description","limit","offset"},new Object[]{likeDescription,limit,offset});
            int totalLength= getHibernateTemplate().find("from " + type.getSimpleName() + " where UPPER(description) LIKE ?",likeDescription).size();
            return new ItemPagingLoadResult(items,totalLength,offset);
        }
    }

  2. #2
    Sencha Premium Member
    Join Date
    Jul 2008
    Posts
    17
    Vote Rating
    0
    winter is on a distinguished road

      0  

    Default


    do I need to set loader.useLoadConfig(..) ? If so what should I put there?

  3. #3
    Sencha Premium Member
    Join Date
    Jul 2008
    Posts
    17
    Vote Rating
    0
    winter is on a distinguished road

      0  

    Default


    Found the issue, the loader needs to be set first; then the page size.

    itemCombo.setLoader(loader);
    itemCombo.setPageSize(10);

  4. #4
    Sencha User
    Join Date
    Mar 2011
    Posts
    2
    Vote Rating
    0
    juangerbi is on a distinguished road

      0  

    Default


    Hi,
    I have the same problem, I want to make a paging combobox, everithing is OK but the ToolBar is not funcional. The loader is set before the page size, but it still does not work. The data is loaded ok, it loads only 10 records, but toolbar is not functional. The only difference is that I'm using a RPCProxy:


    Code:
    		ListStore<Pais> storePaises = new ListStore<Pais>(propsPais.key());
    	    RpcProxy<PagingLoadConfig, PagingLoadResult<Pais>> proxyPaises = new RpcProxy<PagingLoadConfig, PagingLoadResult<Pais>>() {			
    			@Override
    			public void load(PagingLoadConfig loadConfig, AsyncCallback<PagingLoadResult<Pais>> callback) {
    				String filterText = "";
    				filterText = pais.getText();
    
    
    				pais.setEnabled(false);
    				pais.setText("Cargando...");
    				
    				Servlets.getBackendServlet().getPaises(loadConfig, filterText, callback);
    			}
    		};
    		PagingLoader<PagingLoadConfig, PagingLoadResult<Pais>> loaderPaises = new PagingLoader<PagingLoadConfig, PagingLoadResult<Pais>>(proxyPaises);
    		loaderPaises.addLoadHandler(new LoadResultListStoreBinding<PagingLoadConfig, Pais, PagingLoadResult<Pais>>(storePaises){
    			@Override
    			public void onLoad(LoadEvent<PagingLoadConfig, PagingLoadResult<Pais>> event) {
    				pais.setText("");
    				pais.setEnabled(true);
    				super.onLoad(event);
    			}
    		});
    		//loaderPaises.setLimit(10);
    		pais = new ComboBox<Pais>(storePaises, propsPais.nombre());  
    		pais.setLoader(loaderPaises);
    		pais.setPageSize(10);
    		pais.setTypeAheadDelay(500);
    		pais.setTypeAhead(true);
    		pais.setForceSelection(true);
    		pais.setTriggerAction(TriggerAction.ALL);
    		pais.setMinChars(3);
    		pais.setSelectOnFocus(true);
    		pais.setWidth(300);
    		pais.addSelectionHandler(new SelectionHandler<Pais>() {
    			
    			@Override
    			public void onSelection(SelectionEvent<Pais> event) {
    				pais.setValue(event.getSelectedItem());
    				loaderProvincias.load(0, loaderProvincias.getLimit());
    			}
    		});

    Any Ideas? Is something wrong or it's a bug??

  5. #5
    Sencha User
    Join Date
    Mar 2011
    Posts
    2
    Vote Rating
    0
    juangerbi is on a distinguished road

      0  

    Default Found the error

    Found the error


    I've found the error, it was on the server side. Totalcount and offset parameters were inverted while returning data.

    Now the combo is working ok with paging data.

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar