Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » How to add a button to a table cell(How to add a button to a table cell and a pop-up window when the button is clicked)
How to add a button to a table cell [message #1854745] Wed, 07 September 2022 06:33 Go to next message
Tianyu Wu is currently offline Tianyu WuFriend
Messages: 2
Registered: September 2022
Junior Member
Recently, we encountered a requirement to refactor TableView to NatTable, where the original table contains a column of cells containing buttons, and clicking the button triggers a custom dialog event,as shown in the attached picture.

I want to learn Rendering_cells_as_a_link_and_button in NatTable example, but it treats all cells as a button, and I click it and it doesn't trigger the event, I want to know the right way to do it, hope to get your valuable advice.

Re: How to add a button to a table cell [message #1854755 is a reply to message #1854745] Thu, 08 September 2022 05:16 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Hi,

well the example you are referring to is actually not what you want to do. As the example name says, the whole cell is rendered as a button. And this is not what you want to achieve. From the screenshot you want to add a button inside a cell additionally to the cell content.

For doing this you need to do several things:


  1. Create a cell painter that renders the cell content and a button
  2. Create an action that should be triggered on click on the button
  3. Register the cell painter and a ui binding that triggers the action on click


I have created a small example to show this in more detail, as it seems to be not covered anywhere else yet: ButtonInCellExample

The only downside would be that there are no haptics on click, e.g. a highlight or animation of the button on click. But I am not sure if this is really a requirement for a button inside a cell. Adding such a thing would be a quite huge additional effort IIRC.
Re: How to add a button to a table cell [message #1854819 is a reply to message #1854755] Tue, 13 September 2022 06:31 Go to previous message
Tianyu Wu is currently offline Tianyu WuFriend
Messages: 2
Registered: September 2022
Junior Member
Thanks for your response!

I will practice your suggestions in my follow-up. I admit that this is indeed a complex task and I will try to solve it and give feedback in a timely manner.
Previous Topic:How to remove or hide default row numbers when using row group header layer in composite layer
Next Topic:TextCellEditor causes a "SWT Resource was not properly disposed"
Goto Forum:
  


Current Time: Fri Mar 29 15:04:24 GMT 2024

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

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

Back to the top