PDA

View Full Version : Grid Filter in Toolbar ?



Macbeth182
28 Mar 2012, 6:05 AM
Hi,
I have a BeanModel Grid with a Liststore.
I have attached filters like in the example: http://www.sencha.com/examples/#filtergrid

But i need the filters in a toolbar on the top of the grid.
How can i do this ?


Thanks in advance

harun
29 Mar 2012, 2:42 AM
you must write your own filterconfig object. For example:



final FilterConfig filterConfig = new FilterConfig() {
Integer val;

@Override
public void setValue( Object value)
{
val = (Integer) value;
}

@Override
public void setType( String type)
{
}

@Override
public void setField( String field)
{

}

@Override
public void setComparison( String comparison)
{
}

@Override
public boolean isFiltered( ModelData model, Object test, String compariosn, Object value)
{
return false;
}

@Override
public Object getValue()
{
return val;
}

@Override
public String getType()
{
return "numeric";
}

@Override
public String getField()
{
return "rating";
}

@Override
public String getComparison()
{
return "eq";
}
};


after that :


StringFilter strFilter = new StringFilter( "str" );
strFilter.setValue(yourOwnFilterConfig);


and see the result.