Passing parameters in a Container

In this example, we will see how to pass PHP parameters from one application to a widget from a dashboard to another application in another widget. In the dashboard, we will create a widget with an application that shows a grid with orders and another widget with the details of the order selected in the first widget.

Creation of the application for order details.

1. Create a new Grid based on the application of the order_details table, but let’s change the Select command to add a WHERE clause with a variable (where [ord]).

2. Go to the Events >> onScriptInit item in the application menu to assign values ​​to the variable used in the application’s SQL command.

onScriptInit

if (isset ($ _ GET [‘ord’]))
[ord] = “orderid =”. $ _GET [‘ord’];
else
[ord] = “1 = 1”;

3. Generate the source code of the application.

Creating the Order application

1. Create a new Grid application based on the orders table.

2. Access the item Fields >> New field in the application menu.

3. Create a text field of type called “details”.

4. Go to the Events >> onRecord item in the application menu

5. Copy and paste the following code

onRecord

{details} = “<a href = \” javascript: void% 200 \ “onclick = \” parent.document. getElementById (‘id-iframe-widget4’). contentWindow.document.location.href = ‘../ samples_grid_order_details / samples_grid_order_details.php’ + ‘? ord = “. {orderid}.”‘; \ “> <img src = ‘../_lib/img/details.png’ border = ‘0’ Title = ‘Details’ /> </a> “;

AttributeDescription [on
<a href=\ necessaryjavascript:void%200\†> </a>Creating a newlink
parent.document.getElementById(‘id-iframe-widget4’)Iframe used in reference to the secondwidget
.contentWindow. document.location.href = ‘../samples_grid_order_details/samples_grid_order_details.php’+’?ord= side.{orderid} | Reloads the application that will be called, passing a parameter via GET | | <img src = ‘.. / _ lib / img / details.png’ border = ‘0’ Title = ‘Details’ /> | Image used in the application |

Note: We can only know the ID of the desired iframe after creating the Container application. After creating it, go to the “Application >> Source code” item in the Scriptcase menu, with the Container application open for editing. Select to display the index.php code and look for id-iframe-widget.

6. Generate the source code of the application.

Creating a new Dashboard

1. Now we are going to create a new dashboard.

2. In the application menu, go to Settings >> Add Link Widget.

3. Click the Edit Properties link to select the applications that will be displayed in the widgets.

4. Click the Run button on the toolbar.

Tutorials in the same category

Sales dashboard by region

In this tutorial we will be doing an example dashboard we will use the sales table. Creating...

Connections between applications

In this example we will be seeing how to make a connection between applications within the Dashboar...

Officials by Region

In this tutorial we will be creating a dashboard of officials for each region. Creating dash...

Sales dashboard

In this example we will develop a control panel, using the sales table. 1 - Create dashboard...

Comment this post