IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.


#TechXchangePresenter
 View Only
Expand all | Collapse all

Async command link with client events

  • 1.  Async command link with client events

    Posted Thu April 05, 2012 10:42 AM

    Hi,

    In an updateable table, I have introduced a basic column that contains the following components

    -1 async command link
    -1 select row on click

    The command link is defined to invoke delete on the selected row in the table. I find that I need to click on a row (which will be taken care of by the “select row on click” component) and then hit the command link that is named “delete”. I was hoping to improve this so that hitting the command link automatically selects the row the link was clicked.

    For eg.

    row 1->[delete] [column 1] [column 2] [column 3]
    row 2->[delete] [column 1] [column 2] [column 3]
    row 3->[delete] [column 1] [column 2] [column 3]

    When I hit [delete] on row 3, I would like the table to automatically select row 3 so that the action assigned to [delete] can pass the necessary parameters of the select row (row 3) to the action.

    I am thinking we can do this via the Client-Side Events’ Click. When the user clicks on the link, the client-side event for click will kick in (to select the row), and then call the async command action (to delete the row). Is this assumption correct? If so, what should I put in the Client-Side Event’s Click? Any references that I can check out?

    Thank You.


    #webMethods-BPMS
    #BPM
    #webMethods


  • 2.  RE: Async command link with client events

    Posted Fri April 20, 2012 09:28 AM

    I think the following script is an answer to my question:

    1. Get the table model

    2. Add a row change listener to the table

    3. If there is a selected row, do something

      var tableModel = CAF.model(‘#{caf:cid(“defaultForm:asyncTable”)}’);
      tableModel.addRowChangeListener(function(tableId, rowId, eventType) {
      var btnDelete = CAF.model(‘#{caf:cid(“defaultForm:btnDelete”)}’);
      var btnUpdate = CAF.model(‘#{caf:cid(“defaultForm:toggleUpdate”)}’);

      if (tableModel.getRowSelectedCount() > 0)
      {
      btnDelete.setDisabled(false);
      btnUpdate.setDisabled(false);
      var row = CAF.model(rowId);
      var awardTypeId = row.getControlId(“listRowAwardType”);
      var locationId = row.getControlId(“listRowLocation”);
      var descriptionId = row.getControlId(“listRowDescription”);

       var txtAwardType = CAF.model('#{caf:cid("defaultForm:txtAwardType")}');    
      var txtLocation = CAF.model('#{caf:cid("defaultForm:txtLocation")}');    
      var txtDescription = CAF.model('#{caf:cid("defaultForm:txtDescription")}');    
      txtAwardType.setValue(CAF.model(awardTypeId).getValue());
      txtLocation.setValue(CAF.model(locationId).getValue());
      txtDescription.setValue(CAF.model(descriptionId).getValue());            
      

      }
      else {
      btnDelete.setDisabled(true);
      btnUpdate.setDisabled(true);
      }
      });


    #webMethods-BPMS
    #webMethods
    #BPM