Developing a Bulk Editor based Component: the Product List Component
This section provides an overview of how to use the Bulk Editor and gives a description of the existing Geometrixx component based on the Bulk Editor: the Product List component.
The Product List component lets users display and edit a table of data. For example, you can use the Product List component to represent products in a catalog. The information is presented in a standard HTML table and any editing is performed in the Edit dialog box, which contains a BulkEditor widget. (This Bulk Editor is the same as the one accessible at /etc/importers/bulkeditor.html or through the Tools menu). The Product List component has been configured for specific, limited Bulk Editor functionality. Every part of the Bulk Editor (or components derived from the Bulk Editor) can be configured.
With the Bulk Editor, you can add, modify, delete, filter, and export the rows, save modifications, and import a set of rows. Every row is stored as a node under the Product List component instance itself. Every cell is a property of each node. This is a design choice and it can easily be changed, for example, you could store nodes somewhere else in the repository. The query servlet’s role is to return the list of the nodes to display; the search path is defined as a Product List instance.
The source code of the Product List component is available in the repository at /apps/geometrixx/components/productlist and is composed of several parts like all Adobe Experience Manager (AEM) components:
- HTML rendering: the rendering is done in a JSP file (https://experienceleague.adobe.com/apps/geometrixx/components/productlist/productlist.jsp?lang=en). The JSP reads the subnodes of the current Product List component and displays each of them as a row of an HTML table.
- Edit dialog, which is where you define the Bulk Editor configuration. Configure the dialog to match the needs of the component: columns available and possible actions performed on the grid or on the search. See Bulk Editor configuration properties for information on all the configuration properties.
Here is an XML representation of the dialog sub nodes:
<editor
jcr:primaryType="cq:Widget"
colsSelection="[ProductId,ProductName,Color,CatalogCode,SellingSku]"
colsValue="[ProductId,ProductName,Color,CatalogCode,SellingSku]"
contentMode="false"
exportURL="/etc/importers/bulkeditor/export.tsv"
extraCols="Selection"
hideColsSelection="false"
hideContentMode="true"
hideDeleteButton="false"
hideExportButton="false"
hideExtraCols="true"
hideImportButton="false"
hideInsertButton="false"
hideMoveButtons="false"
hidePathCol="true"
hideRootPath="true"
hideSaveButton="false"
hideSearchButton="false"
importURL="/etc/importers/bulkeditor/import"
initialSearch="true"
insertedResourceType="geometrixx/components/productlist/sku"
queryParams=""
queryURL="/etc/importers/bulkeditor/query.json"
saveURL="/etc/importers/bulkeditor/save"
xtype="bulkeditor">
<saveButton
jcr:primaryType="nt:unstructured"
text="Save modifications"/>
<searchButton
jcr:primaryType="nt:unstructured"
text="Apply filter"/>
<queryParamsInput
jcr:primaryType="nt:unstructured"
fieldDescription="Enter here your filters"
fieldLabel="Filters"/>
<searchPanel
jcr:primaryType="nt:unstructured"
height="200">
<defaults
jcr:primaryType="nt:unstructured"
labelWidth="150"/>
</searchPanel>
<grid
jcr:primaryType="nt:unstructured"
height="275"/>
<store jcr:primaryType="nt:unstructured">
<sortInfo
jcr:primaryType="nt:unstructured"
direction="ASC"
field="CatalogCode"/>
</store>
<colModel
jcr:primaryType="nt:unstructured"
width="150"/>
<colsMetadata jcr:primaryType="nt:unstructured">
<Selection
jcr:primaryType="nt:unstructured"
checkbox="true"
forcedPosition="0"
headerText=""/>
<ProductId
jcr:primaryType="nt:unstructured"
cellCls="productlist-cell-productid"
headerText="Product Id"/>
<ProductName
jcr:primaryType="nt:unstructured"
cellStyle="background-color: #FFCC99;"
headerText="Product Name"/>
<CatalogCode
jcr:primaryType="nt:unstructured"
cellStyle="background-color: #EDEDED;"
headerText="Catalog Code"/>
<Color jcr:primaryType="nt:unstructured">
<editor
jcr:primaryType="nt:unstructured"
store="[Blue,Red,Yellow]"
triggerAction="all"
typeAhead="true"
xtype="combo"/>
</Color>
<SellingSku
jcr:primaryType="nt:unstructured"
headerText="Sku Id"/>
</colsMetadata>
</editor>
Bulk Editor Configuration Properties
Every part of the Bulk Editor can be configured. The following table lists all the configuration properties for the Bulk Editor.