Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » refresh after reordering different-sized columns
refresh after reordering different-sized columns [message #1067844] Wed, 10 July 2013 20:09 Go to next message
Mark Proe is currently offline Mark ProeFriend
Messages: 34
Registered: July 2009
Member
Hello,

I have a NatTable that contains columns of different widths.

|--A--|-----B-----|-C-|

I use a ColumnReorderLayer, and my widths are correctly preserved when a column is moved.

|-----B-----|--A--|-C-|

But if I do a refresh on the NatTable after reordering columns, each column position is reverted to its original width as follows...

|--B--|-----A-----|-C-|

Why would this happen?

I was originally using 1.0.0, but I upgraded to 1.0.1 and the problem remains.

Thanks,
Mark
Re: refresh after reordering different-sized columns [message #1067848 is a reply to message #1067844] Wed, 10 July 2013 20:44 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2704
Registered: July 2012
Senior Member
A refresh does a complete refresh by resetting states. Why do you need to refresh? Isn't it possible to fire a more specific event?
Re: refresh after reordering different-sized columns [message #1067853 is a reply to message #1067848] Wed, 10 July 2013 21:05 Go to previous messageGo to next message
Mark Proe is currently offline Mark ProeFriend
Messages: 34
Registered: July 2009
Member
Whenever I update the model used my data provider, I need to be able to display the new data in my NatTable. What is the preferred way to accomplish this? Thanks
Re: refresh after reordering different-sized columns [message #1067855 is a reply to message #1067853] Wed, 10 July 2013 21:49 Go to previous messageGo to next message
Mark Proe is currently offline Mark ProeFriend
Messages: 34
Registered: July 2009
Member
I should also add that I do not know which cells need to be updated, only that my data model has changed. So that is why I was doing the full refresh of NatTable.
Re: refresh after reordering different-sized columns [message #1067908 is a reply to message #1067855] Thu, 11 July 2013 08:18 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2704
Registered: July 2012
Senior Member
Hm, in this case the refresh should be ok. Are you sure that only the column sizes are reset and not also the column order?

I suppose you are doing a

natTable.refresh();


which performs a whole refresh.

Instead you could try to do a soft-refresh like this

natTable.doCommand(new VisualRefreshCommand());


Maybe we should add some kind of convenience soft refresh method. Let me know if this works for you.
Re: refresh after reordering different-sized columns [message #1067968 is a reply to message #1067908] Thu, 11 July 2013 13:12 Go to previous messageGo to next message
Mark Proe is currently offline Mark ProeFriend
Messages: 34
Registered: July 2009
Member
It looks like the VisualRefreshCommand does exactly what I need. Thanks, I did not know there were two separate refresh commands.

(You were right, the column order was being changed. The full refresh apparently exposed a separate issue in my code. But it appears I don't want to do a full refresh anyway. The VisualRefreshCommand is a better option.)
Re: refresh after reordering different-sized columns [message #1067984 is a reply to message #1067968] Thu, 11 July 2013 14:44 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2704
Registered: July 2012
Senior Member
Edwin just reminded me of another, maybe better solution. If you change the data in the background, there might be a different number of rows. So possibly you should fire a RowStructuralChangeEvent from the DataLayer to top instead.
Re: refresh after reordering different-sized columns [message #1067988 is a reply to message #1067844] Thu, 11 July 2013 15:04 Go to previous message
Edwin Park is currently offline Edwin ParkFriend
Messages: 124
Registered: July 2009
Senior Member
You beat me to it. Smile

The advantage of firing the RowStructuralRefreshEvent is that it does exactly what you want it to: it will tell NatTable that the row structure has changed, but will not affect the column structure. So your column reorderings and whatnot will not be affected, but any layers that need to be aware of row structure changes will be notified and react accordingly.

Cheers,
Edwin
Previous Topic:NatTable Examples - 1.0.1
Next Topic:Problem with my Custom Editors with Nattable 1.0.1
Goto Forum:
  


Current Time: Sat Aug 24 14:17:00 GMT 2019

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

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

Back to the top