I know, it works..
But only if i fill two inputs it starts filtering.
If i miss one field - nothing heppens.
public class MyDataProvider extends SortableDataProvider<Object>
implements IFilterStateLocator{
private static final long serialVersionUID = 4127276061657391787L;
DataSource dataSource = QueryFactory.getDataSource();
private final MyDAOImpl dao = new MyDAOImpl(dataSource);
private Map<String, String> filter = new HashMap<String, String>();
final FilterInterface fltr = new FilterInterface() {
private static final long serialVersionUID = 2875452317013449087L;
public boolean isNative() {
return true;
}
public int getNativeFilterMode() {
return 0;
}
public int getFilterCriterionsCount() {
return 2;
}
public FilterCriterionInterface getFilterCriterion(int id) {
ArrayList<FilterCriterionInterface> fcs = new
ArrayList<FilterCriterionInterface>();
FilterCriterionInterface fc = new FilterCriterionInterface() {
public boolean isEnabled() {
return true;
}
public String getTargetField() {
return "Name";
}
public int getFiltermode() {
return 0;
}
public int getCriterionType() {
return
FilterCriterionInterface.STRING_FILTER_CRITERION;
}
public ArrayList<?> getComparedValues() {
return null;
}
public String getComparedValue2() {
return null;
}
public String getComparedValue() {
return filter.get("Name").toString();
}
public String getCompareType() {
return FilterCriterionInterface.ENTRY_IN_WORD;
}
};
FilterCriterionInterface fc2 = new FilterCriterionInterface() {
public boolean isEnabled() {
return true;
}
public String getTargetField() {
return "Path";
}
public int getFiltermode() {
return 0;
}
public int getCriterionType() {
return
FilterCriterionInterface.STRING_FILTER_CRITERION;
}
public ArrayList<?> getComparedValues() {
return null;
}
public String getComparedValue2() {
return null;
}
public String getComparedValue() {
return filter.get("Path").toString();
}
public String getCompareType() {
return
FilterCriterionInterface.ENTRY_IN_WORD;
}
};
fcs.add(fc2);
fcs.add(fc);
return fcs.get(id);
}
};
public MyDataProvider() throws QueryException {
setSort("id", true);
filter = new HashMap<String, String>();
}
public Iterator<Object> iterator(int first, int count) {
SortParam sp = getSort();
return dao.getData(first, count, sp.getProperty(),
sp.isAscending(), fltr).iterator();
}
@SuppressWarnings({ "unchecked", "rawtypes" })
public IModel<Object> model(Object object) {
return new Model((Serializable)object);
}
public int size() {
return dao.getResultSetFullSize(fltr);
}
public Object getFilterState() {
return filter;
}
@SuppressWarnings("unchecked")
public void setFilterState(Object state) {
filter = (Map<String, String>) state;
}
}
2010/7/15 vov <[email protected]>:
>
> Your page look fine, but you do not attach code for 'MyDataProvider'
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/TextFilteredPropertyColumn-feature-tp2289687p2289754.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]