In addition to generating the Web Form of web panels, K2BWebPanelDesigner generates basic code in the events for managing security, paging of all grids, loading of grids without base table, actions confirmation, etc.
To work with this tool, the developer must know that some areas are maintained by K2BTools, while others must be updated by the developer. In those areas the developer may add new code.
To see how this works in practical terms, go to the Events part and see all the events generated by K2BWebPanelDesigner. The rules are as follows:
- GX Standard Events (Start, Refresh, Grid.Load, etc) cannot be modified by the developer.
- Events and subroutines whose name starts with “E_” cannot be modified by the developer.
- Subroutines whose name starts with “U_” can be modified by the developer.
Now, you will add code to implement the “SelectCustomer” action created before. To do so, you must:
- Locate the “U_SelectCustomer” subroutine. Note that the “E_SelectCustomer” event is the event invoked by the button, but it is not editable by the developer. Tip: You can have a direct access to the event by using the GoToEvent action in the "SelectCustomer" node.
|Go to event action
- Add the following code to implement the action
&CustomerId_Filter = CustomerId
CustomerComponent.Object = Customer.Create(K2BTrnMode.Display, &CustomerId_Filter)
- In the first line, the “Customer” filter is updated to filter the invoices that are related to the selected customer.
- In the second line, the CustomerComponent is updated to show the Customer transaction in display mode (for the selected customer)
- In the third line, the Invoices grid is refreshed to show the invoices associated to the new customer.
The Web Panel is complete, you can execute it now to see it in action!