Samples > IBM Sales Center samples: Actions, dialogs, editors and requests


Changing the default sorting order for a table column in the IBM Sales Center

In this sample we will change the sorting order for a table column in the IBM Sales Center. Changing the sorting order is useful for instance, if you do not want the default sorting sequence (ascending).

The following two attributes in the com.ibm.commerce.telesales.widgets.tableDefinitions widget need to be customized to change the default sorting sequence for a table column:

initialSort

The initial sort attribute indicates that this column is the column by which the table should initially be sorted. The default value is false. For a table definition, only one or the first column can be selected for initial sort.

sortingOrder

The sorting sequence for the column to be initially sorted. The argument must be either ASC (acsending) or DESC (descending). The default value is ASC for ascending order. This sorting preference is applicable only when the initialSort attribute is set to true for a particular column.


Create a new plugin in the IBM Sales Center development environment

In this section, we will create a new plugin in the IBM Sales Center development environment to contain the new code. Alternatively, you can download the completed plugin and import it into the IBM Sales Center development environment.

To create a new plugin in the development environment:

  1. Open the IBM Sales Center development environment.

  2. Create a new plugin called changeSortingOrder.

  3. In the plugin, leave the default dependencies and add the com.ibm.commerce.telesales.config as a new dependency. The plugin must contain the following dependencies:

    • org.eclipse.ui

    • org.eclipse.core.runtime

    • com.ibm.commerce.telesales.config

  4. Add an extension to the com.ibm.commerce.telesales.configurator plugin. You can use the plugin editor interface, or edit the plugin.xml file directly. The resulting code should look similar to the following:

    <extension point="com.ibm.commerce.telesales.configurator">
    <configurator path="config" />
    </extension>
    

  5. In the changeSortingOrder plugin project, navigate to the plugin.xml and open the file.

  6. Add an extension to com.ibm.commerce.telesales.widgets.tableDefinitions and define a new table definition by referring to the existing one as shown in the following example.

    <extension point="com.ibm.commerce.telesales.widgets.tableDefinitions">
    <tableDefinition id="mycustomerOrdersSearchResultsTableDefinition">
    <column  referenceId="com.ibm.commerce.telesales.ui.impl.findOrderIdTableColumn" initialSort="true" sortingOrder="DESC" /> 
    <column referenceId="com.ibm.commerce.telesales.ui.impl.findOrderDatePlacedTableColumn" /> 
    <column referenceId="com.ibm.commerce.telesales.ui.impl.findOrderStatusTableColumn" /> 
    <column referenceId="com.ibm.commerce.telesales.ui.impl.findOrderTotalTableColumn" /> 
     
    </tableDefinition >  
    </extension >
    

  7. Define the following entry in the system configuration file to replace the old table definition with the new one:

    com.ibm.commerce.telesales.ui.impl.customerOrdersSearchResultsTableDefinition=test.mycustomerOrdersSearchResultsTableDefinition
    


Test the changes

To test the changes:

  1. Launch the IBM Sales Center; then connect to the WebSphere Commerce Server.

  2. Click Run > Run.

  3. From the Configurations list, select Sales Center.

  4. In the Arguments tab, select Clear workspace data before launching.

  5. Click Run.

  6. When asked if you really want to clear the workspace data, click Yes.

  7. When the IBM Sales Center client opens, click Application > Open > IBM Sales Center > Order Management .

  8. Click File > Logon

  9. Select Store > Find.

  10. Enter the search criteria and select one of the stores from the list.

  11. Select Customer > Find.

  12. Enter search criteria and select one of the customers.

    You can choose either create customer or find customer. In both the cases, make sure there are orders created for that customer before performing the next steps.

  13. Go to the Orders tab of the Customer editor. Order entries are listed in table in descending sequence by the order ID.


Deploy the changes

See Deploy customizations to the IBM Sales Center. See Deployment step of the Customizing the appearance of the IBM Sales Center tutorial.


Related concepts

Overview of customizing IBM Sales Center


+

Search Tips   |   Advanced Search