I want create the universal toolbar for different grids. For example, we have three grid on the screen. And over each grid is a toolbar - create and delete row. I want to set on the button "create" the same action - "addRow". I need to get the name of the grid and the datasource on the current panel, which is a button. How do I do this?

asked 08 Apr '14, 06:23

Ramil's gravatar image

accept rate: 0%

Hi Ramil,

Here is how i would do it:
1) create a seperate toolbar panel for each toolbar (just copy and paste the XML)
2) in the toolbar panel create 2 hidden fields (one for datasource and one for gridname), like

<tableLayout >
  <row height="0">
      <textField value="datasource_name" name="datasource_name" visible="N"/>
      <textField value="grid_name" name="grid_name" visible="N"/>

3) The buttons in the toolbar can link to a generic action 'addRow'. Now to know in which datasource to create the row, you can get get the datasource name from the panel in two ways:
- use api_application.getfocusedcomponent
- use the client event

For button pressed i use the getfocusedcomponent api to get the panel name like:

l_focused_component := api_application.getfocusedcomponent;
l_panel_name := substr (l_focused_component, 1, instr (l_focused_component, '.') -1);

Using the client event, like api_application.getClientEvent().objectName_tx will give you the panel.componentname of the button you pressed, so you could get the panelname from there as well.

Now you know the panel and the component you can simply use the api_component.getvaluetx API to get the datasource and grid name.

Hope this helps,
Michiel A.


answered 08 Apr '14, 10:37

Michiel%20A's gravatar image

Michiel A
accept rate: 13%

Thank you, Michiel. This is a very useful solution, which can be used in many areas.


answered 08 Apr '14, 12:57

Ramil's gravatar image

accept rate: 0%

You're welcome. Glad it helped.

(08 Apr '14, 13:22) Michiel A
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 08 Apr '14, 06:23

Seen: 1,200 times

Last updated: 08 Apr '14, 13:22

© Copyright Gerger 2017