Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Default Nattable, how to edit a cell(Default Nattable, how to edit a cell)
Default Nattable, how to edit a cell [message #985675] Thu, 15 November 2012 16:28 Go to next message
Erik Vande Velde is currently offline Erik Vande VeldeFriend
Messages: 62
Registered: September 2012
Member
I'm very impressed by the capabilties of nattable so far. Only one thing I don't understand: on the main page of the examples, default table, I read " EDIT A SELECTED CELL by typing F2 or edit directly by typing alphanumeric content; if multiple cells with the same ... ". In my case F2 doesn't do a thing, and just typing in a cell doesn't work. What am i Missing ??
Re: Default Nattable, how to edit a cell [message #985784 is a reply to message #985675] Fri, 16 November 2012 07:56 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 1431
Registered: July 2012
Senior Member
Hi,

I looked at the Default NatTable example, and you are right, this example isn't editable. This is because the DefaultEditConfiguration sets the table to be never editable. AFAIK this was done because editing is almost a more complex operation then simply editing text. So you are forced to enable editing and therefore know what you are doing.

As explained in the documentation, editing is a configuration feature. http://eclipse.org/nattable/documentation.php?page=editing

So there is no additional layer. To make editing work with the default, you simply have to set the editing rule to ALWAYS_EDITABLE. As I like to use anonymous inner classes for simple configuration in NatTable, this would be some example code:
NatTable natTable = new NatTable(parent, false);
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
natTable.addConfiguration(new AbstractRegistryConfiguration() {
	public void configureRegistry(IConfigRegistry configRegistry) {
		configRegistry.registerConfigAttribute(
			EditConfigAttributes.CELL_EDITABLE_RULE, IEditableRule.ALWAYS_EDITABLE);
	}
});
natTable.configure();


We will have a look at the example to make sure the description matches the features showed.

Thanks,
Dirk
Previous Topic:Mark/Highlight parts of a text inside column items
Next Topic:Mark same column values by the same color
Goto Forum:
  


Current Time: Thu Dec 18 10:44:32 GMT 2014

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

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