Hallo everyone,

building a toolbar with icons , like delete, save , clear ... and want to be flexible when having more then one datasource. When pressing the DeleteIcon i call a action that calls PKG.Proc (api_datasource.deleterowbyid) The Parameter "in_datasourcename_tx" needs to be flexible.

I don't found an API Call the return the currentDataSourceName (but current DataSourceSchema) ? Can i pass datasourcename via an action to a plsql procedure ? What would be the best way ?

I want to use that toolbar in many application.

Thanks Uwe K

asked 29 Aug '12, 04:31

Uwe%20K's gravatar image

Uwe K
1123
accept rate: 0%


Hi George,

The thing to understand with Formspider is that the moment you click on a button (or any other component), the 'cursor' (ie the focus) is at the component that you clicked on. When there are multiple grids on a screen, there is no way for Formspider to know the previous focused component/grid. So if you need one toolbar to handle actions for multiple grids/datasources, you will have to set the datasource name at the moment you enter the grid (or other component).

In a grid you can user the focusGain event. On this event you could set the grid datasource name to a session variable.

<grid>
  <events>
    <focusGain action="set_grid_datasource_to_session var"/> 
  </events>
  <column>
    <textField ...... />
  </column>
</grid>

The toolbar button can look at the session variable datasource name.

Best regards, Michiel A.

link

answered 22 Feb '13, 03:13

Michiel%20A's gravatar image

Michiel A
5161541
accept rate: 13%

Thank you very much. This has done the job. Now I am facing another related problem. The paging buttons in the toolbar is not aware of two datasources. When you change datasource the page numbers and enable/disable feature for the end/beginning of the tables are not working. There should be a mechanism to inform the current state of the active datasource to the paging toolbar.

Once again thank you for your reply.

George.

(22 Feb '13, 05:02) George
1

Hi George, If you use the nextPage,lastPage components for the paging then there is no way to do it because these components are bound to a single datasource. If you really want to do paging on multiple datasources with the same paging components, then you willl have to create custom paging buttons. See this demo:

http://formspideronline.com/formspider/main.html?name=DemoMain#DemoGrid

But you might want to reconsider this. In my opinion it is better to have the paging with the grids, so that it is clear what the paging is for (also to clarify record nr)

Best, Michiel

(22 Feb '13, 05:36) Michiel A

Thanks. Your advice is taken. Thank you again for the feedback.

(22 Feb '13, 06:00) George

Hi Michiel, Your solution for changing between two datasource has some bugs, I assume. As suggested, the following code was used in panels for datasource1. <events> <focusgain action="action_for_datasource1"/> </events> And this was used for datasource2. <events> <focusgain action="action_for_datasource2"/> </events> The problem is that if you just shift the focus from one datasource to another the focusGain event is not invoked. But if you click a toolbar button once and then come and click the datasource then focusGain event is invoked. Everytime there should be a toolbar click and then datasource click for focusGain procedure to be invoked Can you please kindly find solution for this?

George

(22 Feb '13, 13:51) George

Hello! is there somebody listening. Is Saturday a holiday in Istambul?

George

(23 Feb '13, 03:07) George

Hi George,

Just for your information, i am not an employee of Formspider, i am just a fellow developer trying to help out, and yes, we in the Netherlands have weekends off... As for the focusGain event, maybe one of the Formspider guys can comment on that. I did not test this, but i guess a click in a grid should raise the focusGain event, if it does not , or not always does that it sounds like a bug..

@ Formspider team: can you comment on this please?

Best, Michiel

(23 Feb '13, 04:00) Michiel A

Hi George, I approved that it is a bug and opened a ticked for the case on our issue tracking system.

(23 Feb '13, 04:05) oskansavli ♦♦

Thank you very much. I am waiting for the update.

George.

(23 Feb '13, 04:12) George
showing 5 of 8 show 3 more comments

Hi Uwe,

In Formspider, there is not a "current datasource" concept. Instead there is a "current object" concept where the object can be either a panel, a dialog or a component (grid, textField, button...etc). But since some of these Formspider objects can not be bound to a datasource (like the button component for example), the "current datasource" concept is not applicable for Formspider.

You can retrieve the name of the current Formspider component through the api_application.getFocusedComponent API and the name of the current Formspider dialog through the api_application.getFocusedDialog API. Furthermore, you can find the datasource name of a component with the api_component.getDatasource API.

To achieve your request, you can use a session variable holding the name of the screen which is currently displaying in your application. Just set this session variable when you open a screen. So that in the action code of your toolbar button, you can get the current datasource according to the value of your session variable, which is the name of your current screen.

Regards, Ibrahim

link

answered 29 Aug '12, 07:07

Ibrahim%20Sandalli's gravatar image

Ibrahim Sand... ♦♦
1.5k5
accept rate: 25%

Thanks Ibrahim, session variable i found out works fine for me. regards from berlin

(29 Aug '12, 07:16) Uwe K

Hi Ibrahim,

I have the same issue as Uwe K. I have two datasources in the same screen and a single toolbar menu. If I press the delete button the action should be effected on the datasource where my cursor is sitting. api_application.getFocusedComponent and api_application.getFocusedDialog are returning the window and button name for my toolbar. But my cursor is setting in the grid. This is my datasource. If I use api_component.getDatasource I need to use panel.component argument. This again demands separate calls for each panel.

How can I get my datasource where my cursor is sitting and where my action has to be effected.

I did not also understand how the session variable will help here. If the session varible can hold the datasource name when I change the cursor from one datasource to another then it is easy. If it is possible, at what event the session variable should be stored.

Can you kindly explain with an example. Sorry, I am relatively new to formspider. I am building some generic utilities as part of formspider development.

George

(22 Feb '13, 01:59) George

Hi George, i posted a reply as answer, because it cant fit the comments...

Best regards, Michiel A.

(22 Feb '13, 03:14) 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

By RSS:

Answers

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

Tags:

×60
×8
×3

Asked: 29 Aug '12, 04:31

Seen: 7,053 times

Last updated: 24 Feb '13, 15:14


© Copyright Gerger 2017