Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Fill down function
Fill down function [message #1834730] Tue, 17 November 2020 03:35 Go to next message
kevent smith is currently offline kevent smithFriend
Messages: 6
Registered: November 2020
Junior Member
hello everyone:
I want to realize the function of Ctrl + D similar to excel in the table, that is to fill in the same value in the whole column or selection area. I don't know how to do it. Thank you!
Re: Fill down function [message #1834740 is a reply to message #1834730] Tue, 17 November 2020 09:00 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 29
Registered: March 2020
Junior Member
You need to register a custom key binding and then perform the action you want. For this you need to implement a command and a corresponding commandhandler that you register with a layer (I would suggest the DataLayer as you want to change data).

dataLayer.registerCommandHandler(new MyCustomCommandHandler(this);


Typically you create a AbstractUiBindingConfiguration that you register with your NatTable instance and there add some code like this:

        @Override
        public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
            uiBindingRegistry.registerKeyBinding(
                    new KeyEventMatcher(SWT.MOD1, 's'),
                    new IKeyAction() {
                        @Override
                        public void run(NatTable natTable, KeyEvent event) {
                            natTable.doCommand(new MyCustomCommand());
                        }
                    });
        }

Re: Fill down function [message #1834901 is a reply to message #1834740] Fri, 20 November 2020 06:26 Go to previous messageGo to next message
kevent smith is currently offline kevent smithFriend
Messages: 6
Registered: November 2020
Junior Member
This is the first time that I use nattable. I don't know the underlying source code, so I don't know how to customize commands. Can you help me? thank you!
Re: Fill down function [message #1834902 is a reply to message #1834901] Fri, 20 November 2020 07:09 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 29
Registered: March 2020
Junior Member
Then you need to get familiar with it. Or you pay me for doing your job or ask for a tutorial where I teach you the usage of NatTable.

Have a look at our Getting Started Tutorial: https://www.vogella.com/tutorials/NatTable/article.html
Check out our examples application: https://www.eclipse.org/nattable/documentation.php?page=examples_application

In the _814_EditableSortableGroupByWithFilterExample we for example register actions to save and discard data changes.
Previous Topic:Drag the mouse to select multiple row headers to select multiple rows
Next Topic:Column widths - scaled / unscaled
Goto Forum:
  


Current Time: Sun Jun 13 22:00:31 GMT 2021

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

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

Back to the top