Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » need checkbox only when editable(need checkbox only when editable)
need checkbox only when editable [message #1095692] Tue, 27 August 2013 07:54 Go to next message
Pradyumna Bhide is currently offline Pradyumna Bhide
Messages: 18
Registered: August 2013
Junior Member
Hello all,

I am new to NatTable. I have gone thorough the NatTable examples and its source code but am not getting a solution to one of my problems.
In the NatTable I have a column that should provide a checkbox for selection depending on the value of another column.
I have used Checkboxpainter, checkboxcelleditor, the defaultbooleanconverter and IEditableRule. This renders a checkbox irrespective of whether the cell is editable or not though it allows me to mark the checkbox only if it is editable.

However as per our requirement user should not see the checkbox if the row is not selectable. or in worst case a disabledcheckbox should be rendered for rows that are not selectable.

Can someone please help me out?

Thanks and regards,
Pradyumna
Re: need checkbox only when editable [message #1095801 is a reply to message #1095692] Tue, 27 August 2013 10:51 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1254
Registered: July 2012
Senior Member
You need to add a special label to that cells that show the checkbox and are disabled. Then you are able to register another painter in case the checkbox is not editable.
Re: need checkbox only when editable [message #1096313 is a reply to message #1095801] Wed, 28 August 2013 04:12 Go to previous messageGo to next message
Pradyumna Bhide is currently offline Pradyumna Bhide
Messages: 18
Registered: August 2013
Junior Member
Thanks for your reply Dirk.
I got the solution which is probably a bit different from what you suggest.
I wrote a custom ChecBoxPainter in which i return a null from the getImage method for appropriate cells.
Re: need checkbox only when editable [message #1096317 is a reply to message #1096313] Wed, 28 August 2013 04:17 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1254
Registered: July 2012
Senior Member
I still choose configuration over implementation as this is what NatTable supports. But feel free to use your workaround.
Re: need checkbox only when editable [message #1096975 is a reply to message #1096317] Thu, 29 August 2013 00:44 Go to previous messageGo to next message
Pradyumna Bhide is currently offline Pradyumna Bhide
Messages: 18
Registered: August 2013
Junior Member
Can you tell me how to apply labels to individual cells based on a condition? Also is there a way to show/hide rows with such labeled cells based on an external checkbox?

Thanks in advance
Re: need checkbox only when editable [message #1097031 is a reply to message #1096975] Thu, 29 August 2013 02:42 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1254
Registered: July 2012
Senior Member
http://www.eclipse.org/nattable/documentation.php?page=styling

The chapter on conditional styling should give the necessary information on the labels.

Row hide/show is not implemented via labels. You need to use the RowHideShowLayer and the corresponding commands to implement that.
Re: need checkbox only when editable [message #1097882 is a reply to message #1097031] Fri, 30 August 2013 05:27 Go to previous messageGo to next message
Pradyumna Bhide is currently offline Pradyumna Bhide
Messages: 18
Registered: August 2013
Junior Member
Thanks Dirk.
I resolved show/hide of rows using filterator and a hidden textbox.
Using RowHideShowLayer I would have had to loop through rows searching for particular value in a column and then show/hide the row.
Am I right?

[Updated on: Fri, 30 August 2013 05:27]

Report message to a moderator

Re: need checkbox only when editable [message #1098138 is a reply to message #1097882] Fri, 30 August 2013 13:22 Go to previous message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1254
Registered: July 2012
Senior Member
If you want to hide rows that contain special values, yes
Previous Topic:Ability to bookmark rows
Next Topic:Highlight filtered text
Goto Forum:
  


Current Time: Wed Aug 20 18:44:25 EDT 2014

Powered by FUDForum. Page generated in 0.01908 seconds