Saturday, March 23, 2013

Creation of a row in different tables with a single button click


I have a Create button, and below that 2 tables namely Order and Order_Item. I have created a composition association, and a view link. How can I perform creation of rows in both tables with a single click of Create button?

In order to implement this, create a composition association between the EOs. Then create a method in AM

    public void createItem() {
        ViewRowImpl vor1 = (ViewRowImpl)getOrderVO1().createRow();
        ViewRowImpl vor2 = (ViewRowImpl)getOrderItemVO2().createRow();
        getOrderVO1().insertRow(vor1);
        getOrderItemVO2().insertRow(vor2);
    }
Then create the binding of this method in the ActionListener property of the command button.

    public void createIssue(ActionEvent actionEvent) {
        // Add event code here...
        DCBindingContainer bc = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
        OperationBinding method = bc.getOperationBinding("createItem");
        method.execute();
    }



No comments:

Post a Comment