Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Tracking of data changes
Tracking of data changes [message #1840302] Mon, 12 April 2021 07:43 Go to next message
Alexandra Tritean is currently offline Alexandra TriteanFriend
Messages: 37
Registered: March 2020
Member
Hello,

I'm trying to integrate the functionality of tracking data changes in my grids and I have used Tutorial Examples -> Integration -> EditableSortableGroupByWithFilterExample as reference.

What is implemented there works as expected also in my grids, but I have a 'special' situation that I'm not sure how to handle. I have a custom theme configuration in order to be able to apply a custom style (strikethrough) in some conditions.

I have adapted EditableSortableGroupByWithFilterExample a bit in order to illustrate my case.
You will see that the married persons will be marked with a strikethrough style and on top of a married person there will be a context menu option 'Divorced' and on top of a person that is not married there will be a context menu option 'Married'.
(This is a bit forced and funny for this example, but I wanted to use as base an example that you're familiar with . In my case I'm using this style for marking stuff deprecated).
After using those two options from context menu ("Married"/"Divorced") the discard changes functionality will not revert the changes.

Is there a way in which I can integrate those two concepts or is there another way in which I should implement the strikethrough style in order to be tracked?

Thank you!

Kind Regards,

Alexandra

[Updated on: Mon, 12 April 2021 07:44]

Report message to a moderator

Re: Tracking of data changes [message #1840305 is a reply to message #1840302] Mon, 12 April 2021 08:41 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 47
Registered: March 2020
Member
Your issue is not related to styling. You are missing the concept behind the DataChangeLayer. Your context menu entries are changing the data directly in the underlying data model. This way the DataChangeLayer never gets informed that the data was changed and therefore does not track anything.

If you change the code to update the underlying data model to use an UpdateDataCommand, it should work.

NatEventData natEventData = MenuItemProviders.getNatEventData(event);
natTable.doCommand(new UpdateDataCommand(
        natEventData.getNatTable(),
        natEventData.getColumnPosition(),
        natEventData.getRowPosition(),
        Boolean.FALSE));
Re: Tracking of data changes [message #1840307 is a reply to message #1840305] Mon, 12 April 2021 09:22 Go to previous message
Alexandra Tritean is currently offline Alexandra TriteanFriend
Messages: 37
Registered: March 2020
Member
Awesome! That works like a charm.

Thank you for the help! :)

Kind Regards,

Alexandra
Previous Topic:How to realize print preview?
Next Topic:First key press deleted on macOS
Goto Forum:
  


Current Time: Wed Apr 24 22:31:28 GMT 2024

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

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

Back to the top