Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Filter table data(I want to toggle the filter to see only mine / all tasks)
Filter table data [message #1736587] Thu, 30 June 2016 13:23 Go to next message
Andreas Christ is currently offline Andreas ChristFriend
Messages: 32
Registered: April 2016
Member
I have a table filled with some data (a task list: name, description, id etc.). Now I'd like to implement a button which shows only my data (my name is in a column) after click - any maybe disables that filter to show all tasks again.
My soft requirements:
* I don't want to reload the data from service/DB repetitively (at each button click)
* I don't really need a SearchForm implementation yet. (But if this is needed to fulfill my requirements, I will create that...)

The default filter field in the table-footer works perfectly, but it filters all table columns - and I have to enter my name...

How can I do this in Eclipse Scout (6.0.0)?
Re: Filter table data [message #1736596 is a reply to message #1736587] Thu, 30 June 2016 14:09 Go to previous messageGo to next message
Thomas Pluess is currently offline Thomas PluessFriend
Messages: 3
Registered: May 2016
Junior Member
Hi Andreas,

you could use a column filter:

        @Override
        protected void execClickAction() {
          if (getTableField().getTable().getUserFilterManager().getFilter(getTableField().getTable().getNameColumn().getColumnId()) == null) {
            TextColumnUserFilterState filter = new TextColumnUserFilterState(getTableField().getTable().getNameColumn());
            filter.setFreeText("Your name");
            getTableField().getTable().getUserFilterManager().addFilter(filter);
          }
          else {
            getTableField().getTable().getUserFilterManager().removeFilterByKey(getTableField().getTable().getNameColumn().getColumnId());
          }
        }


This adds/removes a filter state for the NameColumn with the given text. It will be visible on the UI (free text field is filled and the column header is marked with an 'F').
Re: Filter table data [message #1736597 is a reply to message #1736587] Thu, 30 June 2016 14:10 Go to previous messageGo to next message
Andreas Christ is currently offline Andreas ChristFriend
Messages: 32
Registered: April 2016
Member
OK, we found out the following code in the button's execAction() :
			final TableTextUserFilterState f = new TableTextUserFilterState("Andreas".toLowerCase());
			getTable().getUserFilterManager().addFilter(f);


It works quite well...

But Thomas Pluess' solution above is better.

[Updated on: Thu, 30 June 2016 14:23]

Report message to a moderator

Re: Filter table data [message #1736603 is a reply to message #1736596] Thu, 30 June 2016 14:22 Go to previous message
Andreas Christ is currently offline Andreas ChristFriend
Messages: 32
Registered: April 2016
Member
@Thomas Pluess:
Thank you! Works perfectly!!
Very Happy

even better than our solution!

[Updated on: Thu, 30 June 2016 14:23]

Report message to a moderator

Previous Topic:[Mars, SWT] ***BUG*** In pixman_region32_init_rect: Invalid rectangle passed
Next Topic:Adding pages/nodes to an AbstractPageWithNodes dynamically
Goto Forum:
  


Current Time: Thu Mar 28 09:08:59 GMT 2024

Powered by FUDForum. Page generated in 0.02046 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top