Same problem here. I tried a workaround implementing org.tepi.filtertable.FilterGenerator but for my java.util.Date property the generator receives a value of type Boolean instead of DateInterval.
I think the problem is in FilterTable.generateFilter, when it invokes FilterGenerator.generateFilter
if (field instanceof DateFilterPopup) {
/* Handle date filtering */
DateInterval interval = ((DateFilterPopup) field).getDateValue();
if (interval == null) {
/* Date interval is empty -> no filter */
return null;
}
if (filterGenerator != null) {
Filter newFilter = filterGenerator.generateFilter(propertyId,
value); // <-- shouldn't it be interval instead of value? ... or shouldn't be value an instance of DateInterval?
if (newFilter != null) {
return newFilter;
}
}
return new DateFilter(interval, propertyId);
If you pass interval, instead of value, everything works as expected.
I have added added
getColumnIdToFilterMapCopy()
method to
FilterTable
so we can can grab the text in the filter TextField.
I also created a maven pom for the project so there is no need to check in the binaries files and should make keeping up with the latest vaadin jar easier.
My fiter table is working fine when I managed to have left-right alignment i browser,But if I change language to Persian or encoding to right-left alignment,my filter is blocked.Why this is happening.Can you please suggest me.
Could you set createField to protected? I have to create a ComboBox from other source than Enum and couldn’t figure out a way to do so. It would be great if we could override createField.
If there’s some other way to do it, I appreciate any hint.
It would be nice if the standard Table / TreeTable allowed multiple header and footer rows. Then this plugin could be just a builder that created an instance of the standard Table, with the filter fields as a separate header row. Customizing the filtering logic would also be easier too, by simply extending the builder class. Does that sound reasonable? If so, a more experienced person could create a feature request for that.
PS. I am a n00b to Vaadin. I am just evaluating it for a project that I am about to embark on. So far it looks very promising.
Great addon. Saved me the trouble of writing some sort of filtering subsystem. Many thanks!
I discovered a bug though. The FilterTable can only handle container property ids of type String, whereas the normal Table component accepts any object as a property identifier. I worked around it by providing a String as the propertyId, and maintaining a HashMap which links the string to the original object. Below the reproduction code. I tested this with Vaadin 6.7.6 and FilteringTable 0.5.3.
Cheers,
/sohan
public class App extends Application {
@Override
public void init() {
Window mainWindow = new Window();
FilterTable filterTable = new FilterTable();
IndexedContainer container = new IndexedContainer();
/* This line will cause the entire layout to disappear */
PropertyId propertyId = new PropertyId("Column1");
/* Everything works fine when using String propertyId's */
//String propertyId = "Column1";
container.addContainerProperty(propertyId, String.class, null);
Item item1 = container.addItem(1); item1.getItemProperty(propertyId).setValue("Foo");
Item item2 = container.addItem(2); item2.getItemProperty(propertyId).setValue("Bar");
filterTable.setContainerDataSource(container);
filterTable.setFiltersVisible(true);
VerticalLayout layout = new VerticalLayout();
layout.addComponent(filterTable);
layout.addComponent(new Button("OK"));
mainWindow.setContent(layout);
setMainWindow(mainWindow);
}
private class PropertyId {
public String header;
PropertyId(String header) { this.header = header; }
@Override public String toString() { return header; }
}
}
Would it be possible to add some sort of time formatting to the FilterDecorator? The current FilterTable always uses a time in both the date filter button caption and in the popup. If the table property only shows a date (no time) this has the annoying effect that the filter values have to be entered from midnight to midnight.
Example:
- The table contains two items: 1/7/2012 and 2/7/2012
- User wants to see only items for 1/7/2012
- User opens date filter popup and picks date 1/7/2012 in both “From” and “To”
- Chosen dates are automatically appended with current time
- Result: no items are displayed, because items are shown between 1/7/2012 14:10 and 1/7/2012 14:10
- Workaround: enter 1/7/2012 00:00 and 1/7/2012 23:59 (involves manually correcting the values produced by the calendar date picker)
I guess what I am looking for is the possibility to somehow specify that the date filter should not use a time at all. If the FilterTable manages to detect the date/time format of the property itself (the format used to display the property in the table), that would be even better. After all, displaying the date without a time requires a custom format anyway, so the formatter is already in place.
Any thoughts on this? Is there perhaps another way to accomplish this? I understand that I could simply redefine the filter behaviour itself, disregarding the time part. But that still leaves the time portion in both the button caption and in the popup date fields. It just looks silly when the property is, for example, a birth date.
First of all thanks for a wonderful addon. I am considering using it for a project of mine.
In my initial evaluation, i found an issue with the filters not showing up when the table row headers mode is set to Table.ROW_HEADER_MODE_INDEX. If I do not use row headers, the filters seem to be working just fine.
Presently, this is the only issue stopping me from using this addon in my project and I would be happy to see it fixed.
The addon is very usefull, but i am facing some issue.
I am trying to use Filter Table addon and PagedTable addon for a particular table.
I am creating a class like this:
public class FilterAndPagedTable extends FilterTable {
// contains all the methods of PagedTable class
}
public class DemoTable extends Application { @Override
public void init() {
Window mainWindow = new Window(“Home Page”);
FilterAndPagedTable table = new FilterAndPagedTable();
table.setFiltersVisible(true);
table.setContainerDataSource();
mainWindow.addComponent(table);
setMainWindow(mainWindow);
}
}
Issue is : Search boxes for filtering are getting disabled.
Pagination is working fine.
Any suggestions, whats going wrong, why Filter search boxes being disabled.
So there’s no confusion, I am using Vaadin 6.8.1 with 0.5.3 of FilteringTable.
Basically, i already had a set of tables within a Tab Sheet Component already in place,
The screen designed is; top half is a table, bottom half is a tab sheet, with a section of tabs which contain tables. You select from the top half table, which will regenerate the Tab Sheet.
Problem, on first selected, the bottom tab will only display the first tab only, the other 4 are not generated, also on the first tab, there’s nothing display. The first tab should display a Filter Table (2 string cols, 1 enum col and 3 generated cols). which is updated from a container which has its data removed and added. Reclicking the selected item from the top table, generates the bottom half correctly (i.e. 4 tables, with 4 fully working filter tables).
Next problem, you navigate away to another screen, then come back to the screen with the setup above, and both the top and bottom section are not displayed, apart from a single tab (with no table). The top table is a standard vaadin table that worked before.
Inspection using Firebug, shows that the top table is there, and the table on the first tab is there, but is overflow and display is set to hidden. The other 3 tables, are not generated. This seems to be a widget is failing to generate, so is failing silently.
I am using Vaadin 6.8.1 and FilteringTable 0.5.3 and I have a problem - vertical scrollbars do not show up.
This started happening with Vaadin 6.8.0. I have confirmed by switching back to earlier versions and all of 6.7.6 through to 6.7.9 work, 6.8.0 does not.
What is not rendered is the scrollbar itself, the extra pseudo column for the scrollbar is drawn but there is nothing to ‘hold on to’ to scroll.
The table can be scrolled manually by selecting an element and using the keyboard, but not otherwise.
FilteringTable 0.6.0 is now released and available for download in the Directory.
You’ll find a short changelog below. Please do ask if and when there’s anything unclear in the changes :).
Based on the Table from Vaadin 6.8.2.
Added method FilterGenerator.getCustomFilterComponent(Object propertyId) to enable providing customized filter components. This will enable e.g. ComboBoxes with custom value sets as well as CheckBoxes as filter components. Do note that you need to handle the provided values properly in the FilterGenerator.generateFilter -method.
Is now able to handle Object -typed property id:s (instead of just String-typed ones).
Removed getLocale() from FilterDecorator as useless. Now uses the application locale, so make sure it is set correctly.
Added a method in FilterDecorator to provide a “Show All” item caption to be shown in the filter components (instead of blank value) when no filtering is done.
Fixed the FilterGenerator.generateFilter method to be called with a DateInterval as the value when the filter is created for a date column.
Date filtering now uses Between, LessOrEqual and GreaterOrEqual filters in place of the custom DateFilter. This should fix the issues with SQLContainer.
Fixed a bug causing the filters not to show properly when using Table.ROW_HEADER_MODE_INDEX as the row header mode.
Allow hiding filters for certain columns by using FilterGenerator. getCustomFilterComponent(Object propertyId) to return a component with its visibility set to false. Note: returning null will just show the default filtering field!
Tested that column collapsing and reordering works correctly at least in the most common use cases.
Fixed a bug when using generated columns. They should now be usable, but filtering is not possible.
Added notifier methods to FilterGenerator so you can react to filters being removed/added to the datasource by the FilterTable. This allows you to e.g. remove a preset filter from the container when the user inputs a new filtering criteria.
Added means to define both the DateField resolution and a custom formatter for the Date filter date pickers and the displayed value. See FilterDecorator.getDateFormat(Object propertyId) and FilterDecorator.getDateFieldResolution(Object propertyId). The returned DateInterval values also have their Dates truncated to the set resolution.
Great add-on, exactly what we have been looking for. However, I cant get the filter width to adjust with column width . Any ideas what might be going wrong ?
I can’t immediately think of what could be wrong. Which version of Vaadin are you using? Does the
demo work correctly for you? Do you get any exceptions in the vaadin debug window (add ?debug to your application URL)?
It would also be helpful if you could post a (simplified) test case in which the problem occurs.
This add-on is really useful but currently I’m having hard times with fighting following problem:
When scrolling up and down (right scrollbar) in a table and pagination is activated, the table is not always rendered correctly. The table contains empty rows. After refresh or scrolling up again the table is renderded correctly again (empty rows disapeared).
The problem started to appear after I added generated column which contains small image thumbnail (50x50 px). My table is whole editable (but styled in a way that it looks like non editable until you click on text field or native select).
Here is a sample screenshot (you can see that rows 15 - 20 are empty):
This basically happens completely randomly after I scroll table. It’s quite annoying.