cancel
Showing results for 
Search instead for 
Did you mean: 

Table with Coloured Toggle Cells

Former Member
0 Kudos

Hi All,

I need to implement a Table like that:

Mo Tu Wd Th Fr Sa

8.00 - 10.00 Green Red Green Green Green Green

8.00 - 10.00 Green Green Green Green Red Green

The words Green and Red must be icons or images (or something similar) that can be clicked on and the color toggles from Green to Red to Gray depending on the Status.

How can I do that?

Thanks, Johannes

Accepted Solutions (1)

Accepted Solutions (1)

phanir_mullapudi
Active Participant
0 Kudos

Hi Johannes,

It is definitely possible.

as you want something to be clicked upon, Use Button with Image source = ~Icon/GreenLed or YellowLed or RedLed.

When you click, in button event handler method, write code to assign Image souce dynamically.

Hope it helps you.

Thanks,

Phani

Former Member
0 Kudos

Nice. I got that.. However, I've got trouble identifying the exact cell that has been clicked on..

Any ideas, buddy?

THANKS, Johannes

uday_gubbala2
Active Contributor
0 Kudos

Hi Johannes,

Whenever you click upon a cell within the table the framework would be passing a parameter WDEVENT of type CL_WD_CUSTOM_EVENT. You can make use of this parameter for obtaining your row number. You can use the code snippet below to derive the row in which the user clicked upon:

DATA: row TYPE i,
        lob_element TYPE REF TO if_wd_context_element.
  lob_element = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).
  row = lob_element->get_index( ).

And how many such sort of table cells do you need to have in your application? If its just a single one then you can go for the Table's concept of SingleMarkableCell instead. You can check the standard Web Dynpro component WDR_TEST_TABLE for checking out this SingleMarkableCell concept.

Regards,

Uday

ChrisPaine
Active Contributor
0 Kudos

It's worth noting that the event will give you the context element (row) selected and not the attribute (column).

Instead - the parameter returned is the ID - which is the ID of the editor which launched the action - it should be reasonably easy in your code to map this to the attribute in the context element to update.

An easier alternative to getting the selected element from the WDEVENT object is to use the event parameters - in the Actions tab of your view, select your event - and then click on the little blue box (no this is not a Tiffany's ad) next to the search icons on the toolbar above the list of actions - here you can easily add any standard available parameters for the action - id and context element generally being part of these. The parameters are then implicitly available within your event code.

Cheers,

Chris

uday_gubbala2
Active Contributor
0 Kudos

Hi Chris,

Wasn't aware of this approach of making the desired parameters from UI event available for the event handler methods. Thanks for sharing the information. Its a new learning for me.

Regards,

Uday

Answers (0)