Skip to Content

As of Netweaver 7.1 Web Dynpro Java, we have a much better way to implement column sorting in our WDTables using CMI. The simplest way to pass sorting information from Web Dynpro tables to MDM Java API is by using the PageableList class published in Implement Web Dynpro Paging with MDM Java API post. Just extend the existing solution with the required ICMISortable interface so the PageableList sort order can be specified at any time.

The first step is to add ICMISortable interface to the existing PageableList class.

After implementing this interface we have two additional methods to handle onSort() events from Web Dynpro:

  • – void setSortCriterion(CMISortCriterion sortCriterion)
  • – CMISortCriterion getSortCriterion()

a./ Using the View Designer we have to create our onActionSort() action and define  parameter mapping that passes all required information. Inside the method body, use this information and add the sorting criteria to the list:
Parameter mapping
The onActionSort() method body adds sorting information to the PageableList in the view controller:

IDataBeanNode data = wdContext.nodeDataBean();
boolean isdown = WDTableColumnSortDirection.DOWN.equals(direction);
CMISortByColumn criterion = new CMISortByColumn(col, isdown);

b./ Use this information to specify SortDefinitions for the MDM command in the feeder class preparePage() method:

SortDefinition sortdef = new SortDefinition();
CMISortByColumn sort = (CMISortByColumn) sorting;
FieldId fieldId = schema.getFieldId(MAIN_TABLECODE, sort.getColumnName());
sortdef.addSortField(fieldId, sort.isReversed() );

(tip) For the code above to work, you must add the same table column ID as the field code in the repository.

c./ After refreshing the proxy content from MDM, we have to inform the Web Dynpro table about the change from the list.

   public void setSortCriterion(CMISortCriterion cmisortcriterion)
                                               throws CMIIllegalSortCriterionException {
      fireComplexChange(0, size(), CMIObservableListEvent.ELEMENTS_REORDERED);
      m_sortcriterion = cmisortcriterion;

With these additional steps we are done with column sorting implementation. Web Dynpro receives the event from the binded lists and requests new elements from the proxy and thus refreshes the screen data. In the next entry I’ll extend the solution with filter criteria information.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply