Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    SelecItem expected data not filter

    Hi,
    After seeing the showcase and search the forum, I don't understand what is happening.

    The "subcategory" functions as the showcase(not problem, filtered ok), but the "category" no filtering (see the source code)

    I've's try with "setOptionCriteria" and "setPickListCriteria" but nothing.

    I have reviewed the thread
    http://forums.smartclient.com/showthread.php?t=10887&highlight=criteria+selectitem

    I'm using GWT 2.03 and SmartGwt 2.2
    Code:
    	final DynamicForm frm = new DynamicForm();
    		frm.setWidth(470);
    		frm.setNumCols(4);
    		
    		ListGridField fid = new ListGridField("id");
    		ListGridField fcategoria = new ListGridField("categoria");
    		ListGridField fdescripcion = new ListGridField("descripcion");
    		ListGridField fidcategoria = new ListGridField("idcategoria");
    
    		final SelectItem category = new SelectItem();
    		category.setName("cat");
    		category.setTitle("Categoria");
    		category.setOptionDataSource(DSCategoriasTree.getInstance());
    		category.setPickListWidth(450);
    		category.setValueField("id");
    		category.setDisplayField("categoria");
    		category.setPickListFields(fid, fcategoria, fdescripcion, fidcategoria);
    	
    		Criteria criteria = new Criteria();
    		criteria.addCriteria("id", 1);
    		
    		category.setOptionCriteria(criteria);
    		//cat.setPickListCriteria(criteria);
    		
    		SelectItem subCategory = new SelectItem() {
    			@Override
    			protected Criteria getPickListFilterCriteria() {
    				
    				Integer id = (Integer) category.getValue();
    				Criteria criteria = new Criteria();
    				criteria.addCriteria("idcategoria", id);
    				return criteria;
    			}
    		};
    		subCategory.setOptionDataSource(DSCategoriasTree.getInstance());
    		subCategory.setTitle("Sub Categoria");
    		subCategory.setName("subCat");
    		subCategory.setPickListWidth(450);
    		subCategory.setValueField("id");
    		subCategory.setDisplayField("categoria");
    		subCategory.setPickListFields(fid, fcategoria, fdescripcion, fidcategoria);
    		frm.setFields(category, subCategory);
    		
    		return frm;

    #2
    Hi,
    Problem solved.

    I thought the filter was applied to the data captured by the DataSource, but note that the fields (Criteria) are sent to the server.

    Comment

    Working...
    X