Show TOC

Displaying Items When Order is SelectedLocate this document in the navigation structure

Procedure

  1. In the UI Modeler , double-click the OrderCompView node to open the view editor.
  2. Switch to the Layout tab.
  3. In the Outline pane (by default in the bottom-left corner), select the bottom table.

    In the Layout tab of the view editor, a black border appears around the table for order headers to indicate that the entire table is selected. The Properties pane (bottom-right view) displays all table properties.

  4. In the Properties pane, place the cursor in the Value column of the event onLeadSelect.

    Two buttons ( Go (disabled) and Create (enabled)) appear.

  5. Choose Create .
  6. In the wizard, for Name , enter OnOrderHeaderSelect , and leave all other fields as they are.
  7. Choose Finish .
  8. Save your work.
  9. In the Properties pane, place your cursor in the onLeadSelect row.
  10. Choose Go .

    The event handler coding opens. The section that you need to edit is highlighted.

  11. In the event handler, enter a line of code to call the generated custom method getItemsByOrderId() of the component controller to fill the context with the items of the currently selected order.

    The complete code should be as follows:

    /**

    * Event handler [onActionOnOrderHeaderSelect].

    */

    public void onActionOnOrderHeaderSelect (Event wdEvent)

    {

    //@@begin onActionOnOrderHeaderSelect(ServerEvent)

    OrderComp. getInstance ().getItemsByOrderId();

    //@@end

    }

  12. In the context menu of the Component Controller of OrderComp , choose Start of the navigation path Open Next navigation step Java Editor End of the navigation path.
  13. Edit the code of the method getItemsByOrderId() so that it gets the order id of a selected order from the context and set this as an input parameter of the query object getItemsByOrderId .
    1. In the Outline pane (by default in the bottom-left corner), getItemsByOrderId() to find the right section.

    The custom code executes the query, binds the query result to the respective node, and reloads the data into the node.

    The complete code should be as follows:

    /**

    * Method [getItemsByOrderId].

    */

    public void getItemsByOrderId() {

    //@@begin getItemsByOrderId()

    //$$begin (Mobile Service Component)

    if (wdContext.nodeorder_srv().nodegetOrderHeaders().nodegetOrderHeadersOutput().currentgetOrderHeadersOutputElement() != null )

    {

    getItemsByOrderId.setPi_orderid(wdContext.nodeorder_srv().nodegetOrderHeaders().nodegetOrderHeadersOutput().currentgetOrderHeadersOutputElement().getOrderid());

    wdContext.nodeorder_srv().nodegetItemsByOrderId().nodegetItemsByOrderIdOutput().bind(getItemsByOrderId.execute());

    wdContext.nodeorder_srv().nodegetItemsByOrderId().nodegetItemsByOrderIdOutput().reload();

    }

    //$$end

  14. Save your work.