Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Filtering grouped columns(How to filter several columns at once)
Filtering grouped columns [message #1385513] Sun, 08 June 2014 08:53 Go to next message
Gal Rogozinski is currently offline Gal RogozinskiFriend
Messages: 40
Registered: June 2014
Member
Hello,

I want to group specific columns in my NatTable so that a single cell in FilterRowHeaderComposite could apply a filter on all the columns in that specific group.

I can't figure out how to do so...

Does anyone know?


Thanks!!!
Re: Filtering grouped columns [message #1385569 is a reply to message #1385513] Mon, 09 June 2014 15:01 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
One filter row cell for three columns? Not sure, one thing is rendering of the filter row between the column group and column header. The other thing is to implement a custom filter logic that applies three filters at once. Check the filter strategy to get an idea.
Re: Filtering grouped columns [message #1385777 is a reply to message #1385569] Wed, 11 June 2014 07:46 Go to previous messageGo to next message
Gal Rogozinski is currently offline Gal RogozinskiFriend
Messages: 40
Registered: June 2014
Member
Hmm I wrote this method in CustomSpanningDataProvider:

@Override
	public DataCell getCellByPosition(int columnPosition, int rowPosition) {
		String columnLabel = m_underlyingDataProvider.getColumnHeaderLabel(m_hideShowLayer.getColumnIndexByPosition(columnPosition));
		if (columnLabel.matches(".* \\d")){
			columnLabel = columnLabel.substring(0, columnLabel.length()-2);
		}
		if (m_groups.containsKey(columnLabel)){
			int startCol = m_hideShowLayer.getColumnPositionByIndex(Collections.min(m_groups.get(columnLabel)));
			int span = Collections.max(m_groups.get(columnLabel)) - Collections.min(m_groups.get(columnLabel)) + 1;
			return new DataCell(startCol, rowPosition, span, 1);
		}
         return new DataCell(columnPosition, rowPosition);
	}


The problem is that for every spanned cell I create several other spanned cells are created that have the same position and properties...
What do I do?
Re: Filtering grouped columns [message #1385799 is a reply to message #1385777] Wed, 11 June 2014 09:40 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
I'm not sure. Take a look at existing examples. Possibly you need to operate on indeces rather than positions.
Re: Filtering grouped columns [message #1385815 is a reply to message #1385799] Wed, 11 June 2014 11:47 Go to previous messageGo to next message
Gal Rogozinski is currently offline Gal RogozinskiFriend
Messages: 40
Registered: June 2014
Member
I saw an old post in the sourceforge forum that sounds like my problem.
The forum doesn't let me post the link but googling "sourceforge nattable spanning" should bring it up.

Is the problem described there fixed?

I also noticed that in spanningDataLayer the following method is overriden:

@Override
	public Rectangle getBoundsByPosition(int columnPosition, int rowPosition) {
		ILayerCell cell = getCellByPosition(columnPosition, rowPosition);
		return super.getBoundsByPosition(cell.getOriginColumnPosition(), cell.getOriginRowPosition());
	}


I don't use it because it deosn't work for me. Perhaps this is my pitfall?
Re: Filtering grouped columns [message #1385821 is a reply to message #1385815] Wed, 11 June 2014 12:08 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
I don't find the post you mention, so I don't know whether a possible bug is fixed or not.

And yes, maybe that is your pitfall. For spanning you need to use both, SpanningDataLayer and SpanningDataProvider.
Previous Topic:Can row groups and column groups use together?
Next Topic:Making cells editable
Goto Forum:
  


Current Time: Fri Apr 19 14:38:21 GMT 2024

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

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

Back to the top