Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » programmatically resize column
programmatically resize column [message #1197335] Tue, 19 November 2013 21:38 Go to next message
Testr t is currently offline Testr tFriend
Messages: 93
Registered: April 2013
Member
Hi,

I am using the Nattable in Eclipse plugin and I am trying to find an option to do the column resize programatically based on some user action. I tried to use the InitializeAutoResizeColumnsCommand and it didnt correctly resize the columns. then I tried the solution in the link http://eclipse.org/nattable/documentation.php?page=faq and it did resize the column automatically but there is extra spacing in the column surrounding the text and also when I scroll the repainting of the columns is visible and it looks bad. Also it does the resize for all columns and I want to specifically resize a column based on index. I am using the 1.0.1 release.

natTable.addConfiguration(new DefaultNatTableStyleConfiguration() {
	{
		cellPainter = new LineBorderDecorator(
						new TextPainter(false, true, 5, true));
	}

Is there any other way I can do the resize for a column.
Re: programmatically resize column [message #1197351 is a reply to message #1197335] Tue, 19 November 2013 21:50 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2751
Registered: July 2012
Senior Member
Quote:
Also it does the resize for all columns and I want to specifically resize a column based on index.


Then register the TextPainter with automatic size calculation only to those columns that should auto resize.

Quote:
I tried to use the InitializeAutoResizeColumnsCommand and it didnt correctly resize the columns.


Then check back the FAQ section as there are also some examples on using the command.

Quote:
Is there any other way I can do the resize for a column.


No, either try to get the command working for your use case or use the automatic sizing on rendering. But if you are having a huge dataset, the initial automatic calculation could cause serious performance issues. That's why there is the solution on resizing on rendering. Even if you think it looks bad.
Re: programmatically resize column [message #1197387 is a reply to message #1197351] Tue, 19 November 2013 22:15 Go to previous messageGo to next message
Testr t is currently offline Testr tFriend
Messages: 93
Registered: April 2013
Member
Okay, Yes I had a huge dataset and even double clicking the column(corner) to resize also had performance issue. the grid hanged and it took a long time to resize. I believe i can remove the autoresize binding.

And with the automatic sizing on rendering option, the reason i say its bad is because when I scroll I see empty lines for a sec and then the cells are painted. I have a huge dataset displayed and when scrolling its not smooth. Am i using something wrong and you dont see this behavior? But this option is feasible as it does the correct resizing.
Re: programmatically resize column [message #1198191 is a reply to message #1197387] Wed, 20 November 2013 07:33 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2751
Registered: July 2012
Senior Member
Quote:
the grid hanged and it took a long time to resize


Of course, because it iterates over the whole dataset and calculates the optimum size.

Quote:
the reason i say its bad is because when I scroll I see empty lines for a sec and then the cells are painted


Yes this was reported several times already. But I don't see a solution for this. Resizing on rendering means that when the cell comes to the viewport the first time, the calculation is started. If you scroll further, the new cells in the viewport will be calculated. While calculating, the rendering pauses. I even tried to do that process in a background thread, but it doesn't change anything. You could think of setting the initial width higher to avoid too much calculation, but in general I don't see a suitable solution.

If you find one, let me know.
Previous Topic:Structural Refresh does not keep Column Order
Next Topic:Cell editor issue
Goto Forum:
  


Current Time: Sat Dec 07 12:13:41 GMT 2019

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

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

Back to the top