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.

 View Only
Expand all | Collapse all

SelectableListTableContentProvider header order

webMethods Community Member

webMethods Community MemberFri April 08, 2016 05:41 PM

  • 1.  SelectableListTableContentProvider header order

    Posted Fri April 08, 2016 01:57 PM

    Hello,

    I have a SelectableListTableContentProvider that the user can sort all values by selecting on headers, like this image (header1.png)

    How can I restart this sorting, using a button action? I tried to set all values null or empty, but i got exception.

    Thanks!


    #webMethods-BPMS
    #webMethods
    #MWS-CAF-Task-Engine


  • 2.  RE: SelectableListTableContentProvider header order

    Posted Fri April 08, 2016 02:15 PM

    You would want to find the column controls and set the ordinal and ascending properties appropriately.

    For example, something like this:

    
    UIComponent component = findComponentInRoot("tableIdHere");
    if (component instanceof UIData) {
    UIData dataTable = (UIData)component;
    
    //the column to make the primary sort column
    String idToSortBy = "columnIdHere";
    //which direction to order by
    boolean isAscending = true;
    for (Iterator<UIComponent> it = dataTable.getChildren().iterator(); it.hasNext();) {
    UIComponent child = it.next();
    if (child instanceof IExtendedColumn) {
    IExtendedColumn column = (IExtendedColumn)child;
    if (idToSortBy.equals(child.getId())) {
    //make this the primary sort column
    column.setOrdinal(1);
    column.setAscending(isAscending);
    } else {
    //don't sort by this column
    column.setOrdinal(0);
    }
    }
    }
    }

    #MWS-CAF-Task-Engine
    #webMethods-BPMS
    #webMethods


  • 3.  RE: SelectableListTableContentProvider header order

    Posted Fri April 08, 2016 02:31 PM

    Eric, thanks for reply.

    No, I just want to set the header for original status. The values I will call a refresh action on my connector.

    Thanks!


    #webMethods-BPMS
    #MWS-CAF-Task-Engine
    #webMethods


  • 4.  RE: SelectableListTableContentProvider header order

    Posted Fri April 08, 2016 02:33 PM

    I’m not following what you are saying.

    Can you provide any additional details?


    #MWS-CAF-Task-Engine
    #webMethods-BPMS
    #webMethods


  • 5.  RE: SelectableListTableContentProvider header order

    Posted Fri April 08, 2016 02:40 PM

    Sure.

    Looking at the image, the user sorted all table values selecting on header.

    Now, I have an action button that needs to clean this header selection and clean all values in table.

    To clean all values that’s ok, but I don’t know how to clean the header selection.

    Thanks!


    #webMethods
    #MWS-CAF-Task-Engine
    #webMethods-BPMS


  • 6.  RE: SelectableListTableContentProvider header order

    Posted Fri April 08, 2016 02:43 PM

    That’s basically what the snippet I provided does. It will reset the sort/order state of the columns to make one of the columns the primary sort column and clear any sort state from the other columns.


    #webMethods-BPMS
    #webMethods
    #MWS-CAF-Task-Engine


  • 7.  RE: SelectableListTableContentProvider header order

    Posted Fri April 08, 2016 04:26 PM

    I have put this code on the onClick action Button and didn’t work, the button have no more action


    #webMethods
    #MWS-CAF-Task-Engine
    #webMethods-BPMS


  • 8.  RE: SelectableListTableContentProvider header order

    Posted Fri April 08, 2016 05:21 PM

    The code snippet I provided is server side java code that could be run in the action handler method for a command button.

    The onClick value for a button is client-side javascript. The column sort state can not be changed for multiple columns at the same time from javascript.


    #webMethods
    #MWS-CAF-Task-Engine
    #webMethods-BPMS


  • 9.  RE: SelectableListTableContentProvider header order

    Posted Fri April 08, 2016 05:41 PM


  • 10.  RE: SelectableListTableContentProvider header order

    Posted Mon April 11, 2016 05:54 PM

    Eric, can I ask you one more thing?

    It’s possible to select none values on table?

    For example, I have selected some lines using checkbox, when I click on action button, all checkboxes needs to be cleared, like when I click on select none on “Select all rows checkbox”.

    Thanks


    #MWS-CAF-Task-Engine
    #webMethods-BPMS
    #webMethods


  • 11.  RE: SelectableListTableContentProvider header order



  • 12.  RE: SelectableListTableContentProvider header order

    Posted Mon April 11, 2016 06:06 PM

    Hi Luis,

    You can set the selected row ids to null using the table provider as shown below:

    getTableResultProvider().setRowSelectedIds(null);

    #webMethods-BPMS
    #MWS-CAF-Task-Engine
    #webMethods


  • 13.  RE: SelectableListTableContentProvider header order

    Posted Mon April 11, 2016 06:21 PM

    It worked!
    Thank you Eric and Prasad!!


    #MWS-CAF-Task-Engine
    #webMethods
    #webMethods-BPMS