Hi, Users should be able to insert, delete and query records in every grid. Currently i do this with an actions menu for every grid. For example: in a master-detail-detail the master and details each have an action menu. That looks a little bit stupid: 3 action menu's. Why not one at the top of the screen. Indeed - just like Oracle Forms. I can not figure out how to do that because i run into a problem... When the user clicks in one of the grids and clicks "insert record" in the generic action menu, i want that new record to appear in that specific grid. The question now is: how can i determine in which grid the user is working? Probably there is an api but the only one i can find is api_application.getfocusedcomponent. And that always returns the name of the panel of the generic actions. Does anyone have a solution for this? Kind regards, Jan Willem Vermeer |
Hi Jan, I hava no solution for your generic idea, but what's wrong about using one action for each insert activity? Maybe you can handle it like this: - Create one common create-procedure in your package: "createRow(p_datasource name in varchar2)" - create three sub-procedures ("creMaster", "creMasterDetail", "creMasterDetailDetail") in this package, which pass the corresponding datasource name to the procedure "createRow" - create three actions "creMaster", "creMasterDetail", "creMasterDetailDetail" to the corresponding procedures I tried to find another way. My intention was to add a listener-event to panel/datasource which notices the clicked/fetched current datasource. But this does not work. Kind regards Florian |
Thanks Florian, i think i have found a solution. I have added the event "focusGain" to every grid and that calls a procedure to set a global variable. When i click a generic button, i read the value from the global variable. Thusfar i have not seen problems with this method. Kind regards, Jan Willem Hi Jan, Yes, this is what I was going to suggest, too. I also opened an internal ticket so that we can explore if it is possible to create a new API which returns the current Formspider Object the cursor is in. Kind Regards,
(10 Sep '15, 06:35)
Yalim Gerger ♦♦
|
Hi all, i run into a serious issue... After many discussions i had decided to build a generic toolbar. To detect the current datasource, i use event "focusgain". That worked perfectly.... Until i ran into empty datasources. Now i have the situation of a master-detail form on one page and both datasources are empty. When i press "New Row" in the generic toolbar, there is no current datasource because focusgain only works on rows. Did anyone find out a solution for this problem? Or is there no solution and is that the reason why it is necessary to use separate toolbars for each datasource? Kind regards, Jan Willem |
Hi, Always check whether you have a valid datasource on the focused item. If yes, store it in session variable. Your session variable will always have last focused valid datasource. Function that check whether your datasource is valid:
Hope this helps. Regards, George.
link
This answer is marked "community wiki".
|
Thanks George. I am using a session variable with the focused datasource and that works perfectly as long as it is possible to use focusgain to detect in which datasource the user clicks. My problem now is that i have two empty (!) datasources on one form. Users can never click in an empty datasource. So, the focusgain event is never fired and the session variable is empty. When i press button "new row", it needs to know where to create a new row. But there is no way to figure that out. I can only think of two solutions: 1) Limit the number datasources on one page to 1. You can not use master-detail forms anymore, so for me this will not work. 2) Make sure that every datasource shows at least one row. When the datasource is empty, that should be an empty row. But that will make the datasource dirty and lead to problems during commit. If you have a 3rd option that will always work, i am happy to hear. I do not yet know all formspider tricks, but can not imagine that there is a work-around for this. A challenge for all experienced developers :) Kind regards, Jan Willem |
Hi Jan, Check the Force Current Row property of the datasource. You will always get an empty row for that datasource. Here you have a way to fire focusgain event. You will not have a dirty datasource. I am using master-detail-detail setup in the same visible page without a problem. Regards, George. |
Hi George, thanks ! I did not know this feature. Indeed the datasources now always show an empty row and when i click in it, focusgain is fired so i know where i am. But this leads to a new challenge: when i press "new row" the api api_datasource.createRow is called and that creates a second new row... Is there an api to check if there is already an empty row shown? There is a constant row_status_new but i can not find an api to use that. Kind regards, JW |
Aha, found...
Or is there a better solution? KR JW |