Creating the gift reward grid class or list view definition for the user interface
In this lesson, you create the Management Center user interface element in which business users specify the free gift and quantity information for the promotion.
This Management Center user interface element is:- A grid class that is used in a properties view class that you create in the next lesson.
- A list view that is used in a properties view definition that you create in the next lesson.
About this task
- Type
- Catalog entry
- Quantity for free
By default, the Promotions tool has a gift reward grid. The grid contains two columns: Type and Catalog entry. To support your new promotion type, add an additional column called Quantity for free.
You must also customize this gift grid to allow business users to add additional rows, to accommodate multiple (different) catalog entries as gifts. This is covered in the next lesson, Creating the promotion properties view for the user interface.
Procedure
- Complete one of the following steps:
Option Description Create a folder for the gift reward grid class - In the Enterprise Explorer view, navigate to the directory.
- Right-click the promotion folder and click .
- In the Folder name field, type listViewDefinitions.
- Click Finish. The directory structure should
now look like this screen capture:
Create a folder for the gift reward list view definition - In the Enterprise Explorer view, navigate to the directory.
- Right-click the promotion folder and click .
- In the Folder name field, type listViewDefinitions.
- Click Finish. The directory structure should
now look like this screen capture:
- Complete one of the following steps:
Option Description Create a new OpenLaszlo file to define the new gift grid - Right-click the listViewDefinitions folder.
- Click .
- Click .
- In the "Select a wizard" window, expand the Simple folder and click File.
- Click Next.
- Name your new file ChildListEditorListViews.lzx.
- Click Finish to save the file. The file opens in the default XML editor.
Create a new definition file to define the new gift list view - Right-click the listViewDefinitions folder.
- Click .
- Name your new file ChildListEditorListViews.def.
- Click Finish to save the file. The file opens in the default XML editor.
- To define the gift reward grid:
Option Description ChildListEditorListViews.lzx In this new class file: - Copy and paste the following code:
<library> <class name="extProGiftRewardGrid" extends="proProductGrid" preferenceKey="extProductGrid"> <wcfGridStepper name="giftQuantity" propertyName="giftQuantity" minimumValue="1" editable="true" visible="true" width="200" required="true" text="${extPromotionResources.promotion_Free_gift_qty.string}" /> </class> </library>
- Save and close the file.
This class extends the proProductGrid class, which the Promotions tool provides. This class displays the contents and characteristics of a list of SKUs, products, or kits as promotion gifts. On this grid, the code above adds a new column named giftQuantity to capture this value. The wcfGridStepper class is used as an input widget to allow business users to enter an integer for the gift quantity. This column is defined as a mandatory entry, and the minimum value is 1.
ChildListEditorListViews.def In this new definition file: - Copy and paste the following code:
<Definitions> <ObjectGrid definitionName="extProGiftRewardGrid" baseDefinitionName="proProductGrid" preferenceKey="extProductGrid"> <GridStepper name="giftQuantity" propertyName="giftQuantity" minimumValue="1" editable="true" visible="true" width="200" required="true" text="${extPromotionResources.promotion_Free_gift_qty}"/> </ObjectGrid> </Definitions>
- Save and close the file.
This definition extends proProductGrid definition, which the Promotions tool provides. This definition displays the contents and characteristics of a list of SKUs, products, or kits as promotion gifts. On this grid, the previous code sample adds a new column named giftQuantity to capture this value. The wcfGridStepper class is used as an input widget to allow business users to enter an integer for the gift quantity. This column is defined as a mandatory entry, and the minimum value is 1.
- Copy and paste the following code:
- Right-click the ChildListEditorListViews.lzx file; then click Build OpenLaszlo Project on the context menu.
- Register the grid class file in
the promotion extensions library: