Description: A multiSelect component is an integration of two grids. One grid will have the available items and the other the selected items. We can add an item to the second grid from the first or do the inverse action. We can also have a form to filter the available items.
A good example of this is a shopping cart where the stock represents available items and the cart the selected items.
JavaDoc: Click here
Remarks: This encloses basically two different grid components. It can also integrate with a form component, like the Grid also does.
Body content: JSP context.
Attributes:
Name | Description | Data type | Required | Default value |
id | The name (identifier) of the grid. | String | Yes | - |
noDataMessage | Message to show when there are no rows to show. | String | No | - |
plainHtml | Forces HTML table even in rich mode | Boolean | No | False |
idColumn | The identifier for the id used in the Two Grids | String | No | id |
groupColumn | The column to use as a group column. | String | No | - |
recordsperpage | The number of records in each page. Can only be used with "ajaxEvent". | Number | No | - |
serversort | Perform sorting on the server side. Only with "ajaxEvent". | Boolean | No | Always true if recordsperpage is used |
renderFootnotes | Defines if footnotes are rendered on the element. | Boolean | No | True |
descriptionColumnId | Defines the description column for selected values grid | String | Yes | - |
availablesDataSet | Defines the available Grid dataset | String | Yes | - |
selectedDataSet | Defines the selected Grid dataset | String | Yes | - |
addEvent | Defines Ajax add event | String | Yes | - |
deleteEvent | Defines Ajax delete event | String | Yes | - |
titleAvailable | Defines available grid title | String | No | - |
titleSelected | Defines selected grid title | String | No | - |
width | Defines selected grid title | String | No | - |
idSelectedColumn | If the id column for selected grid is different from the id from available grid | String | No | - |
descriptionSelectedColumn | If we want to define a different text for the description column on selected grid | String | No | - |
enableDragAndDrop | Defines if drag and drop is enable or not | Boolean | No | False |
Examples:
View - JSP file
<dif:multiSelect id="shoppingCart" selectedDataSet="stock" availableDataSet="cart" descriptionColumnId="productName" addEvent="addProductToCart" deleteEvent="removeProductFromCart" > <dif:form> <dif:comboField id="category" options="${stage.categories}" /> </dif:form> <dif:column id="productName" width="100"/> <dif:column id="price" width="100"/> </dif:multiSelect>
@OnAJAX("stock") protected IJSONResponse getStockItems() { // This method will return all available the products not present int the cart // The list off productd will be filtered by form filters if we use a form } @OnAJAX("cart") protected IJSONResponse getCartItems() { // This method will return all selected products in the cart } @OnAJAX("addProductToCart") protected boolean addProductToCart() { // This method add's a product to the cart } @OnAJAX("removeProductFromCart") protected boolean removeProductFromCart() { // This method removes a product from the cart }
See also: