Skip to main content



      Home
Home » Eclipse Projects » NatTable » refresh after reordering different-sized columns
refresh after reordering different-sized columns [message #1067844] Wed, 10 July 2013 16:09 Go to next message
Eclipse UserFriend
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 16:44 Go to previous messageGo to next message
Eclipse UserFriend
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 17:05 Go to previous messageGo to next message
Eclipse UserFriend
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 17:49 Go to previous messageGo to next message
Eclipse UserFriend
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 04:18 Go to previous messageGo to next message
Eclipse UserFriend
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 09:12 Go to previous messageGo to next message
Eclipse UserFriend
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 10:44 Go to previous messageGo to next message
Eclipse UserFriend
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 11:04 Go to previous message
Eclipse UserFriend
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: Fri Jul 04 09:42:42 EDT 2025

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

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

Back to the top