FilteringTable add-on

Hi,

I need you help again… I made a FilterTable with a containerDataSource and I added 2 other columns addGeneratedColumn and I set a FilterGenerator fpr the Table.
When I override the getCustomFilterComponent of the FilterGenerator and print the propertyIds I get 2 null
for the 2 new added Columns. Why I get null for them and how I can change that?
I need the propertyId to create a Compoment for one of the new Columns I added.

Can you help me with this problem, please.

Thanks for advance,

Aissam

Hi,

I have a coulumn which contains a Vaadin image. How to hide the filter explicitly for this column?

Hi,

you can call the following method:

setFilterFieldVisible(columnId, visible);

Just give the propertyId of your image columns and false as parameters and the filter field should not be rendered.

-tepi

Thanks alot for your prompt reply. And great add on

Great plugin. Unfortunately it’s again broken with last version (7.2.4).
Widgetset compiling fail with :
[ERROR]
Errors in ‘jar:file:/C:/Users/me/.ivy2/cache/org.vaadin.addons/filteringtable/jars/filteringtable-0.9.9.v7.jar!/org/tepi/filtertable/gwt/client/ui/FilterTableConnector.java’
[ERROR]
Line 257: The method isHandlerRunning() is undefined for the type VCustomScrollTable.RowRequestHandler

Has anybody the same trouble ? I’m using latest add-on version : 0.9.9v7

Regards

Ok, never mind.
Ivy was messing up with an old version.

Regards

Hi Teppo,
I am trying to put
another widget
in a table like your
filter bar
. I want to add above to the header.
It is working fine in all of your table(
Filtertable
,
FilterTreeTable
). But in case of
FilterTreeTable
when I am trying to expand the node by clicking the expand icon present in first column of each row, the table become static. I have my sample project.

I posted a questen in vaadin forum as

https://vaadin.com/forum#!/thread/7770525

.

With that I attached my sample project.

Can you please give me some solution for it.

You already added a filterbar to the table. Like that I want to add another bar for another header.

Thank You

Hi,
I got the problem why it is not working. Actually my widget is added in index 0. If I am inserting to index 3 its working properly. May be the expand action depands on the index number. When I am adding my stuff to index 0 all other things index increased by one. So the required thing of expand action is not getting as all things indexes are changed. So I need your help to do this thing. Please give me some solution so that I can insert my stuff in index 0 and the tree will work properly…

Hi,
In your demo also after clicking node expand in FilterTreeTable it is not expanding and all things become static. No other data loading to table on scroll event and filter is not working. Can you please check it

Just wondering if anyone can help me out with this…

I just installed 7.3.beta1 and am testing out the new Valo theme (which by the way is truly slick). All seems good except the date filter popup (attached). Also, no matter what css my table is, it seems the filter bar is always grey.

Is there an easy way to access the css for the filtering table? I am not very good when manipulating the css items so if it not too much trouble can someone provide an example.

Thank you,

Eric
15506.png

Eric,
Search this thread for “Override styles for FilterTable” to find an example of some CSS. I recommend a WebKit based browser (Chrome, Safari) and press F12 to browse and experiment with CSS on your live page.

Hi Teppo,

First of all thank you for this great addon. It’s basically the base component of our application.

But as some people mentioned (and were seemingly left unanswered) I also encountered the problem of filter fields not resizing correctly. I have a FilterBar which can be toggled using a Button, and when the Bar is hidden, I also reset all filtering on the table.
This means that I not only have to remove the filters from the container, but also empty the values of the filter fields.
The ‘only’ method FilteringTable provides for this is resetFilters() and this will cause the filter field cells to have incorrect widths when resizing the columns when the FilterBar is hidden and then shown again. (This mostly happens with filter fields having ComboBox components.)

The only workaround I found to this is iterating through all the visible columns, getting their filter field component and resetting their value as follows (which I can’t even do in a generic way, since TextFields have to be set to empty string rather than null):

Component filterField = table.getFilterField(column);
                            
if (filterField != null) {
                        
    if (filterField instanceof TextField)
     ((TextField) filterField).setValue("");
    else
     ((AbstractField)filterField).setValue(null);
}

And this might not be the fastest way around.

Could you please provide a method that only resets their value but does not rebuild the filter fields? Or something that makes them resize properly.
Strangely enough, when they have incorrect width and you manually resize Any of the columns on the UI, they correct their widths automatically. But if you call a setColumnWidth() they won’t do a thing.
[i]

[/i]

Hi Teppo,

I’ve just started to use Vaadin and I find your FilteringTable very useful. Thanks!
But from some reason I can’t get a comboBox as a filter, although I followed your demo’s code.
Puting a breakpoint in generateFilter shows that this method is not accessed by the server at all.
Here’s example code of mine. I’ll be glad for your (or anybody else on the forum) assistance.

Thanks again,

package com.example.vaadintbl;

import javax.servlet.annotation.WebServlet;

import org.tepi.filtertable.FilterTable;

import com.vaadin.annotations.Theme;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.CustomTable.RowHeaderMode;
import com.vaadin.ui.Label;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;

@SuppressWarnings("serial")
@Theme("vaadintbl")
public class VaadintblUI extends UI {

    @WebServlet(value = "/*", asyncSupported = true)
    @VaadinServletConfiguration(productionMode = false, ui = VaadintblUI.class, widgetset = "com.example.vaadintbl.widgetset.VaadintblWidgetset")
    public static class Servlet extends VaadinServlet {
    }

    @Override
    protected void init(VaadinRequest request) {
        final VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        setContent(layout);
        
        layout.addComponent(new Label("blah"));

        FilterTable filterTable = new FilterTable();

        initTable(filterTable);
        
        layout.addComponent(filterTable);
    }
    
    /**
     * Initialize the FilterTable
     * @param filterTable
     */
    public void initTable(FilterTable filterTable) {
        
        //filterTable.setfullsize();
        filterTable.setWidth("700px");

        filterTable.setSelectable(true);
        filterTable.setImmediate(true);
        filterTable.setMultiSelect(true);

        filterTable.setRowHeaderMode(RowHeaderMode.INDEX);

        filterTable.setColumnCollapsingAllowed(true);

        filterTable.setColumnCollapsed("state", true);

        filterTable.setColumnReorderingAllowed(true);
        
        filterTable.addContainerProperty("First Name", String.class,  null);
        filterTable.addContainerProperty("Last Name",  String.class,  null);
        filterTable.addContainerProperty("Year",       Integer.class, null);
        filterTable.addContainerProperty("Dead", Boolean.class, null);

        /* Add a few items in the filterTable. */
        filterTable.addItem(new Object[] {
            "Nicolaus","Copernicus",new Integer(1473),new Boolean(true)}, new Integer(1));
        filterTable.addItem(new Object[] {
            "Tycho",   "Brahe",     new Integer(1546),new Boolean(false)}, new Integer(2));
        filterTable.addItem(new Object[] {
            "Giordano","Bruno",     new Integer(1548),new Boolean(true)}, new Integer(3));
        filterTable.addItem(new Object[] {
            "Galileo", "Galilei",   new Integer(1564),new Boolean(true)}, new Integer(4));
        filterTable.addItem(new Object[] {
            "Johannes","Kepler",    new Integer(1571),new Boolean(false)}, new Integer(5));
        filterTable.addItem(new Object[] {
            "Isaac",   "Newton",    new Integer(1643),new Boolean(true)}, new Integer(6));
        filterTable.addItem(new Object[] {
            "Nicolaus","Copernicus",new Integer(1473),new Boolean(true)}, new Integer(7));
        filterTable.addItem(new Object[] {
            "Tycho",   "Brahe",     new Integer(1546),new Boolean(false)}, new Integer(8));
        filterTable.addItem(new Object[] {
            "Giordano","Bruno",     new Integer(1548),new Boolean(false)}, new Integer(9));
        filterTable.addItem(new Object[] {
            "Galileo", "Galilei",   new Integer(1564),new Boolean(false)}, new Integer(10));
        filterTable.addItem(new Object[] {
            "Johannes","Kepler",    new Integer(1571),new Boolean(true)}, new Integer(11));
        filterTable.addItem(new Object[] {
            "Isaac",   "Newton",    new Integer(1643),new Boolean(false)}, new Integer(12));
        
        System.out.println(filterTable.getContainerPropertyIds());
        
        filterTable.setFilterDecorator(new MyFilterDecorator());
        filterTable.setFilterGenerator(new MyFilterGenerator());
        
        filterTable.setFilterBarVisible(true);
        
    }

}package com.example.vaadintbl;

import java.io.Serializable;

import org.tepi.filtertable.FilterGenerator;

import com.vaadin.data.Container.Filter;
import com.vaadin.data.util.filter.Compare;
import com.vaadin.data.util.filter.Or;
import com.vaadin.server.Page;
import com.vaadin.ui.AbstractField;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.Field;
import com.vaadin.ui.Notification;

@SuppressWarnings("serial")
public class MyFilterGenerator implements FilterGenerator, Serializable{

    @Override
    public Filter generateFilter(Object propertyId, Object value) {
        if("Year".equals(propertyId)) {
            if(value != null && value instanceof String) {
                try {
                    return new Compare.Equal(propertyId, value);
                } catch (Exception e){
                    e.printStackTrace();
                }
            }
        }
        else if ("Dead".equals(propertyId)) {
            if(value != null && value instanceof Boolean) {
                if (Boolean.TRUE.equals(value)) {
                    return new Compare.Equal(propertyId, value);
                }
                else {
                    return new Or(new Compare.Equal(propertyId, true),
                            new Compare.Equal(propertyId, false));
                }
            }
        }
        return null;
        
    }

    @Override
    public Filter generateFilter(Object propertyId, Field<?> originatingField) {
//        if ("Dead".equals(propertyId)) {
//            if(originatingField.getValue() != null && (originatingField.getValue() instanceof Boolean)) {
//                if (Boolean.TRUE.equals(originatingField.getValue())) {
//                    return new Compare.Equal(propertyId, originatingField.getValue());
//                }
//                else {
//                    return new Or(new Compare.Equal(propertyId, true),
//                            new Compare.Equal(propertyId, false));
//                }
//            }
//        }
        return null;
    }

    @Override
    public AbstractField<?> getCustomFilterComponent(Object propertyId) {
        if ("Dead".equals(propertyId)) {
            CheckBox box = new CheckBox();
            return box;
        }
        return null;
    }

    @Override
    public void filterRemoved(Object propertyId) {
        Notification n = new Notification("Filter removed from: " + propertyId,
                Notification.Type.TRAY_NOTIFICATION);
        n.setDelayMsec(800);
        n.show(Page.getCurrent());
        
    }

    @Override
    public void filterAdded(Object propertyId,
            Class<? extends Filter> filterType, Object value) {
        Notification n = new Notification("Filter added to: " + propertyId,
                Notification.Type.TRAY_NOTIFICATION);
        n.setDelayMsec(800);
        n.show(Page.getCurrent());
        
    }

    @Override
    public Filter filterGeneratorFailed(Exception reason, Object propertyId,
            Object value) {
        // TODO Auto-generated method stub
        return null;
    }

}package com.example.vaadintbl;

import java.io.Serializable;

import org.tepi.filtertable.FilterGenerator;

import com.vaadin.data.Container.Filter;
import com.vaadin.data.util.filter.Compare;
import com.vaadin.data.util.filter.Or;
import com.vaadin.server.Page;
import com.vaadin.ui.AbstractField;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.Field;
import com.vaadin.ui.Notification;

@SuppressWarnings("serial")
public class MyFilterGenerator implements FilterGenerator, Serializable{

    @Override
    public Filter generateFilter(Object propertyId, Object value) {
        if("Year".equals(propertyId)) {
            if(value != null && value instanceof String) {
                try {
                    return new Compare.Equal(propertyId, value);
                } catch (Exception e){
                    e.printStackTrace();
                }
            }
        }
        else if ("Dead".equals(propertyId)) {
            if(value != null && value instanceof Boolean) {
                if (Boolean.TRUE.equals(value)) {
                    return new Compare.Equal(propertyId, value);
                }
                else {
                    return new Or(new Compare.Equal(propertyId, true),
                            new Compare.Equal(propertyId, false));
                }
            }
        }
        return null;
        
    }

    @Override
    public Filter generateFilter(Object propertyId, Field<?> originatingField) {
//        if ("Dead".equals(propertyId)) {
//            if(originatingField.getValue() != null && (originatingField.getValue() instanceof Boolean)) {
//                if (Boolean.TRUE.equals(originatingField.getValue())) {
//                    return new Compare.Equal(propertyId, originatingField.getValue());
//                }
//                else {
//                    return new Or(new Compare.Equal(propertyId, true),
//                            new Compare.Equal(propertyId, false));
//                }
//            }
//        }
        return null;
    }

    @Override
    public AbstractField<?> getCustomFilterComponent(Object propertyId) {
        if ("Dead".equals(propertyId)) {
            CheckBox box = new CheckBox();
            return box;
        }
        return null;
    }

    @Override
    public void filterRemoved(Object propertyId) {
        Notification n = new Notification("Filter removed from: " + propertyId,
                Notification.Type.TRAY_NOTIFICATION);
        n.setDelayMsec(800);
        n.show(Page.getCurrent());
        
    }

    @Override
    public void filterAdded(Object propertyId,
            Class<? extends Filter> filterType, Object value) {
        Notification n = new Notification("Filter added to: " + propertyId,
                Notification.Type.TRAY_NOTIFICATION);
        n.setDelayMsec(800);
        n.show(Page.getCurrent());
        
    }

    @Override
    public Filter filterGeneratorFailed(Exception reason, Object propertyId,
            Object value) {
        // TODO Auto-generated method stub
        return null;
    }

}package com.example.vaadintbl;

import java.io.Serializable;

import org.tepi.filtertable.FilterGenerator;

import com.vaadin.data.Container.Filter;
import com.vaadin.data.util.filter.Compare;
import com.vaadin.data.util.filter.Or;
import com.vaadin.server.Page;
import com.vaadin.ui.AbstractField;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.Field;
import com.vaadin.ui.Notification;

@SuppressWarnings("serial")
public class MyFilterGenerator implements FilterGenerator, Serializable{

    @Override
    public Filter generateFilter(Object propertyId, Object value) {
        if("Year".equals(propertyId)) {
            if(value != null && value instanceof String) {
                try {
                    return new Compare.Equal(propertyId, value);
                } catch (Exception e){
                    e.printStackTrace();
                }
            }
        }
        else if ("Dead".equals(propertyId)) {
            if(value != null && value instanceof Boolean) {
                if (Boolean.TRUE.equals(value)) {
                    return new Compare.Equal(propertyId, value);
                }
                else {
                    return new Or(new Compare.Equal(propertyId, true),
                            new Compare.Equal(propertyId, false));
                }
            }
        }
        return null;
        
    }

    @Override
    public Filter generateFilter(Object propertyId, Field<?> originatingField) {
//        if ("Dead".equals(propertyId)) {
//            if(originatingField.getValue() != null && (originatingField.getValue() instanceof Boolean)) {
//                if (Boolean.TRUE.equals(originatingField.getValue())) {
//                    return new Compare.Equal(propertyId, originatingField.getValue());
//                }
//                else {
//                    return new Or(new Compare.Equal(propertyId, true),
//                            new Compare.Equal(propertyId, false));
//                }
//            }
//        }
        return null;
    }

    @Override
    public AbstractField<?> getCustomFilterComponent(Object propertyId) {
        if ("Dead".equals(propertyId)) {
            CheckBox box = new CheckBox();
            return box;
        }
        return null;
    }

    @Override
    public void filterRemoved(Object propertyId) {
        Notification n = new Notification("Filter removed from: " + propertyId,
                Notification.Type.TRAY_NOTIFICATION);
        n.setDelayMsec(800);
        n.show(Page.getCurrent());
        
    }

    @Override
    public void filterAdded(Object propertyId,
            Class<? extends Filter> filterType, Object value) {
        Notification n = new Notification("Filter added to: " + propertyId,
                Notification.Type.TRAY_NOTIFICATION);
        n.setDelayMsec(800);
        n.show(Page.getCurrent());
        
    }

    @Override
    public Filter filterGeneratorFailed(Exception reason, Object propertyId,
            Object value) {
        // TODO Auto-generated method stub
        return null;
    }

}package com.example.vaadintbl;

import java.io.Serializable;

import org.tepi.filtertable.FilterGenerator;

import com.vaadin.data.Container.Filter;
import com.vaadin.data.util.filter.Compare;
import com.vaadin.data.util.filter.Or;
import com.vaadin.server.Page;
import com.vaadin.ui.AbstractField;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.Field;
import com.vaadin.ui.Notification;

@SuppressWarnings("serial")
public class MyFilterGenerator implements FilterGenerator, Serializable{

    @Override
    public Filter generateFilter(Object propertyId, Object value) {
        if("Year".equals(propertyId)) {
            if(value != null && value instanceof String) {
                try {
                    return new Compare.Equal(propertyId, value);
                } catch (Exception e){
                    e.printStackTrace();
                }
            }
        }
        else if ("Dead".equals(propertyId)) {
            if(value != null && value instanceof Boolean) {
                if (Boolean.TRUE.equals(value)) {
                    return new Compare.Equal(propertyId, value);
                }
                else {
                    return new Or(new Compare.Equal(propertyId, true),
                            new Compare.Equal(propertyId, false));
                }
            }
        }
        return null;
        
    }

    @Override
    public Filter generateFilter(Object propertyId, Field<?> originatingField) {
//        if ("Dead".equals(propertyId)) {
//            if(originatingField.getValue() != null && (originatingField.getValue() instanceof Boolean)) {
//                if (Boolean.TRUE.equals(originatingField.getValue())) {
//                    return new Compare.Equal(propertyId, originatingField.getValue());
//                }
//                else {
//                    return new Or(new Compare.Equal(propertyId, true),
//                            new Compare.Equal(propertyId, false));
//                }
//            }
//        }
        return null;
    }

    @Override
    public AbstractField<?> getCustomFilterComponent(Object propertyId) {
        if ("Dead".equals(propertyId)) {
            CheckBox box = new CheckBox();
            return box;
        }
        return null;
    }

    @Override
    public void filterRemoved(Object propertyId) {
        Notification n = new Notification("Filter removed from: " + propertyId,
                Notification.Type.TRAY_NOTIFICATION);
        n.setDelayMsec(800);
        n.show(Page.getCurrent());
        
    }

    @Override
    public void filterAdded(Object propertyId,
            Class<? extends Filter> filterType, Object value) {
        Notification n = new Notification("Filter added to: " + propertyId,
                Notification.Type.TRAY_NOTIFICATION);
        n.setDelayMsec(800);
        n.show(Page.getCurrent());
        
    }

    @Override
    public Filter filterGeneratorFailed(Exception reason, Object propertyId,
            Object value) {
        // TODO Auto-generated method stub
        return null;
    }

}
package com.example.vaadintbl;

import java.io.Serializable;

import org.tepi.filtertable.FilterGenerator;

import com.vaadin.data.Container.Filter;
import com.vaadin.data.util.filter.Compare;
import com.vaadin.data.util.filter.Or;
import com.vaadin.server.Page;
import com.vaadin.ui.AbstractField;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.Field;
import com.vaadin.ui.Notification;

@SuppressWarnings("serial")
public class MyFilterGenerator implements FilterGenerator, Serializable{

    @Override
    public Filter generateFilter(Object propertyId, Object value) {
        if("Year".equals(propertyId)) {
            if(value != null && value instanceof String) {
                try {
                    return new Compare.Equal(propertyId, value);
                } catch (Exception e){
                    e.printStackTrace();
                }
            }
        }
        else if ("Dead".equals(propertyId)) {
            if(value != null && value instanceof Boolean) {
                if (Boolean.TRUE.equals(value)) {
                    return new Compare.Equal(propertyId, value);
                }
                else {
                    return new Or(new Compare.Equal(propertyId, true),
                            new Compare.Equal(propertyId, false));
                }
            }
        }
        return null;
        
    }

    @Override
    public Filter generateFilter(Object propertyId, Field<?> originatingField) {
//        if ("Dead".equals(propertyId)) {
//            if(originatingField.getValue() != null && (originatingField.getValue() instanceof Boolean)) {
//                if (Boolean.TRUE.equals(originatingField.getValue())) {
//                    return new Compare.Equal(propertyId, originatingField.getValue());
//                }
//                else {
//                    return new Or(new Compare.Equal(propertyId, true),
//                            new Compare.Equal(propertyId, false));
//                }
//            }
//        }
        return null;
    }

    @Override
    public AbstractField<?> getCustomFilterComponent(Object propertyId) {
        if ("Dead".equals(propertyId)) {
            CheckBox box = new CheckBox();
            return box;
        }
        return null;
    }

    @Override
    public void filterRemoved(Object propertyId) {
        Notification n = new Notification("Filter removed from: " + propertyId,
                Notification.Type.TRAY_NOTIFICATION);
        n.setDelayMsec(800);
        n.show(Page.getCurrent());
        
    }

    @Override
    public void filterAdded(Object propertyId,
            Class<? extends Filter> filterType, Object value) {
        Notification n = new Notification("Filter added to: " + propertyId,
                Notification.Type.TRAY_NOTIFICATION);
        n.setDelayMsec(800);
        n.show(Page.getCurrent());
        
    }

    @Override
    public Filter filterGeneratorFailed(Exception reason, Object propertyId,
            Object value) {
        // TODO Auto-generated method stub
        return null;
    }

}package com.example.vaadintbl;

import java.io.Serializable;
import java.util.Locale;

import org.tepi.filtertable.FilterDecorator;
import org.tepi.filtertable.numberfilter.NumberFilterPopupConfig;

import com.vaadin.server.Resource;
import com.vaadin.shared.ui.datefield.Resolution;

@SuppressWarnings("serial")
public class MyFilterDecorator implements FilterDecorator, Serializable{

    @Override
    public String getEnumFilterDisplayName(Object propertyId, Object value) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public Resource getEnumFilterIcon(Object propertyId, Object value) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public String getBooleanFilterDisplayName(Object propertyId, boolean value) {
//        if ("Dead".equals(propertyId)) {
//            return value? "Yes" : "No";
//        }
        return null;
    }

    @Override
    public Resource getBooleanFilterIcon(Object propertyId, boolean value) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public boolean isTextFilterImmediate(Object propertyId) {
        // TODO Auto-generated method stub
        return true;
    }

    @Override
    public int getTextChangeTimeout(Object propertyId) {
        // TODO Auto-generated method stub
        return 500;
    }

    @Override
    public String getFromCaption() {
        return "From: ";
    }

    @Override
    public String getToCaption() {
        return "To: ";
    }

    @Override
    public String getSetCaption() {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public String getClearCaption() {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public Resolution getDateFieldResolution(Object propertyId) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public String getDateFormatPattern(Object propertyId) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public Locale getLocale() {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public String getAllItemsVisibleString() {
        return "Show all items";
    }

    @Override
    public NumberFilterPopupConfig getNumberFilterPopupConfig() {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public boolean usePopupForNumericProperty(Object propertyId) {
        // TODO Auto-generated method stub
        return true;
    }

}
package com.example.vaadintbl;

import java.io.Serializable;
import java.util.Locale;

import org.tepi.filtertable.FilterDecorator;
import org.tepi.filtertable.numberfilter.NumberFilterPopupConfig;

import com.vaadin.server.Resource;
import com.vaadin.shared.ui.datefield.Resolution;

@SuppressWarnings("serial")
public class MyFilterDecorator implements FilterDecorator, Serializable{

    @Override
    public String getEnumFilterDisplayName(Object propertyId, Object value) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public Resource getEnumFilterIcon(Object propertyId, Object value) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public String getBooleanFilterDisplayName(Object propertyId, boolean value) {
//        if ("Dead".equals(propertyId)) {
//            return value? "Yes" : "No";
//        }
        return null;
    }

    @Override
    public Resource getBooleanFilterIcon(Object propertyId, boolean value) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public boolean isTextFilterImmediate(Object propertyId) {
        // TODO Auto-generated method stub
        return true;
    }

    @Override
    public int getTextChangeTimeout(Object propertyId) {
        // TODO Auto-generated method stub
        return 500;
    }

    @Override
    public String getFromCaption() {
        return "From: ";
    }

    @Override
    public String getToCaption() {
        return "To: ";
    }

    @Override
    public String getSetCaption() {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public String getClearCaption() {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public Resolution getDateFieldResolution(Object propertyId) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public String getDateFormatPattern(Object propertyId) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public Locale getLocale() {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public String getAllItemsVisibleString() {
        return "Show all items";
    }

    @Override
    public NumberFilterPopupConfig getNumberFilterPopupConfig() {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public boolean usePopupForNumericProperty(Object propertyId) {
        // TODO Auto-generated method stub
        return true;
    }

}

Hi Teppo,

Like Rajesh I use a legacy non-standard theme for my UI - what I would like is to have my layout use “reindeer” just for the FilterTable is that possible.

I played around and I can’t seem to get it to work e.g. the widget in “reindeer”. I looks great in reindeer (picture #1) but when I try to use the widget with the legacy theme it hets a bit ugly (picture #2)

Any advise would be appreciated

  • Jon

15728.jpg
15729.jpg

Jon,

Search this thread for a pair of post by me two years ago. I posted some CSS to make FilterTable work with the Runo theme, and it still works with the latest version. It may not work exactly for you with your theme, but should point you to where to focus on.

Teppo’s FIlterTable is working great for me, but I’m stuck on adding one feature.

I would like to have a double mouse click select a row (like a single mouse click) and also trigget a popup window.

My issue centers around that fact that a the selection is actually triggered via a “valueChange” which seems disjoint from the “itemClick”. In addition a double click can select then deselct and item at which point there is no selection.

The code below works but it seems a bit kludgey to store the last selected item (from “valueChange”) to do what I want in “itemClick” - any thoughts on improving this?

[code]
Object S_lastSelection = null;

    // Handle and/or report a selection change.
    filterTable.addValueChangeListener(new Property.ValueChangeListener() {
        public void valueChange(ValueChangeEvent event) {
            Object sel = filterTable.getValue();
            if (sel != null) {
                // print some debug information 
                System.out.println("Selected: .... " + sel);
                // save the last non-NULL selection (not multi select)to us in "itemClick"
                S_lastSelection = sel;
            }
        }
    });
    
    filterTable.addItemClickListener(new ItemClickEvent.ItemClickListener() {
        public void itemClick(ItemClickEvent event) {
            // print some debug information 
            String dsel = "";
            if (event.isDoubleClick()) {
                dsel = " (doubleclick)";
            }
            Object sel = filterTable.getValue();
            String tsel = "no selection";
            if (sel != null) {
                tsel = "selection is : " + sel;
            }
            if (event.getButton() == MouseButton.RIGHT) {
                System.out.println("itemClick - MouseButton.RIGHT : " + tsel + dsel);
            } else
            if (event.getButton() == MouseButton.LEFT) {
                System.out.println("itemClick - MouseButton.LEFT : " + tsel + dsel);
            } else {
                System.out.println("itemClick -  other : " +  tsel + dsel);
            }

            // this is a klugey way make a double click act like a select/and do an action
            if (event.isDoubleClick() && S_lastSelection != null) {
                // use the last non-NULL selection (if any) from "valueChange"
                filterTable.select(S_lastSelection);
                UI.getCurrent().showNotification("double-clicked! on item " + S_lastSelection + " which should be == " + filterTable.getValue());
            }
        }
    });

[/code]Thanks in Advance

  • Jon

that’s a very useful tool and I’d love to work with it but I keep getting this error when I re-complie my project

Compiling module com.example.demo.widgetset.ParsioWidgetset
   Validating newly compiled units
      [ERROR]
 Errors in 'jar:file:/C:/Users/rsabassi/workspace/Parsio/WebContent/WEB-INF/lib/filteringtable-0.9.2-sources.jar!/com/vaadin/terminal/gwt/client/ui/VCustomScrollTable.java'
         [ERROR]
 Line 28: The import org.tepi.filtertable.gwt.client.ui.VFilterTreeTable cannot be resolved
         [ERROR]
 Line 6799: Incompatible conditional operand types VCustomScrollTable and VFilterTreeTable
         [ERROR]
 Line 6799: VFilterTreeTable cannot be resolved to a type
         [ERROR]
 Line 7620: The method getFocusElement() is undefined for the type FocusableScrollPanel
Aug 14, 2014 10:27:35 AM com.vaadin.terminal.gwt.widgetsetutils.ClassPathExplorer getPaintablesHavingWidgetAnnotation
INFO: Searching for paintables..
Aug 14, 2014 10:27:36 AM com.vaadin.terminal.gwt.widgetsetutils.ClassPathExplorer getPaintablesHavingWidgetAnnotation
INFO: Search took 825ms
Widgetset compilation completed

then an error appears by “com.example.demo.widgetset” in my package explorer. And when I checked my web.xml file I found only one widgetset in the servlet.

<init-param> <description> Application widgetset</description> <param-name>widgetset</param-name> <param-value>com.example.demo.widgetset.ParsioWidgetset</param-value> </init-param> I’m not using maven. I installed the jar files and added both of them to my web-inf/lib.
Do I need to add anything to my web.xml file?

Hi Teppo,

In witch version do you add filterable nested columns in your addon??

Regards

What is the plan for FilteringTable once Vaadin 7.4 arrives with the new Grid component?

  • FilteringTable will be adapted and will continue (sounds like a challenge given cell merging etc.)
  • Filtering will be built into Grid?
  • Filtering will be lost?

FilteringTable is a valued addition to Table but Grid will bring welcome improvements too. Will we have to pick one or the other or will filtering be available in 7.4?

Hi Steve,

currently I am planning to adapt the filtering logic to Grid as soon as possible after a passable version of Grid has been released. I’ve been promised that Grid will be more easily extendable so hopefully there’s no need for any copy-paste, and the filtering feature could be an extension for Grid. As far as I know, there’s no plans of integrating the filtering feature directly into the Grid.

Hopefully this answered your questions!

-tepi