Tutorials > Sales Center > Add an editable column to the Order Items table by creating a new widget manager
Create a new definition for the user interface widget
In this step, you create the own definition of the Order Items table for adding a new editable column. In a later step in this tutorial, you use the system configurator to indicate that the IBM Sales Center should display this definition, not the default definition.
- Click the Extensions tab of the plugin.xml.
- Click Add.
- From the Extension Points list, select com.ibm.commerce.telesales.widgets.tableDefinitions. This is the extension point for creating a new table definition.
- Click Finish.
- Select com.ibm.commerce.telesales.widgets.tableDefinitions > tableDefinition.
- In the Extensions Element Details pane:
- Set the id to customizedItemTable.
- Set the referenceId value to com.ibm.commerce.telesales.ui.impl.orderItemPageTableDefinition.default and save the changes.
Recall the information you determined in Determine the ID of the user interface widget to modify. The referenceId is the default table definition as defined in the com.ibm.commerce.telesales.ui.impl.order plug-in. Because the new table is the same as the old one except with an additional Fulfillment Center column, you use the reference to the original table definition so that you can inherit the original definition and add to it by defining a new column.
- Right-click customizedItemTable and select New > column.
- In the Extensions Element Details pane, set the following values:
Name Value Id fulfillmentColumn Alignment LEFT Text extendedOrderItem.fulfillmentData minimumWidth 20 Resizable True managerType myNewOrderItemsManager modelPath field1 cellEditorType combo enabled true userData true
This creates the new column with the ID of fulfillmentColumn . The text for the column refers to the properties file entry that you created previously. The managerType value is the ID of the new widget manager that you are going to define and create. The modelPath value defines how the column is populated. In this case the value represents the name-value pair you can read from the BOD. Because you set the modelpath="field1 " and userData="true", the user's choice of selecting Fulfillment value is automatically saved to the server's Order Items table. Here "field1" attribute is mapped to orderItems table's field1.The remaining properties define column attributes.
The Extensions Element Details pane is similar to the following screen capture:
- Save the changes.
- Right-click fulfillmentColumn and select New > property.
- In the Extensions Element Details pane, set the following values:
Name Value name columnType value com.example.commerce.telesales.myNewPracticePlugin.orderItemPageItemTableFullfillment
- Save the file.
- Click the plugin.xml tab and examine the table definition's source code:
<tableDefinition referenceId="com.ibm.commerce.telesales.ui.impl.orderItemPageTableDefinition.default" > <column resizable="true" text="extendedOrderItem.fulfillmentData" enabled="true" cellEditorType="combo" managerType="myNewOrderItemsManager" minimumWidth="20" alignment="LEFT" modelPath="field1" userData="true" > <property value="com.example.commerce.telesales.myNewPracticePlugin.orderItemPageItemTableFullfillment" name="columnType"/> </column> </tableDefinition>