Develop > Presentation layer > Customize WebSphere Commerce Accelerator, Organization Administration Console, or Administration Console > Tools framework > Slosh buckets
Slosh bucket JavaScript functions
You can use the following JavaScript functions in the slosh bucket, they are implemented in WebSphere Commerce by default. The following functions are defined in the parent frame, and are called using parent.functionName():
Function Name Description move(fromList, toList) Moves one or more items from one list box to the other. For example, from one list box that lists all possible products to another list box that lists the products a customer wants to order. It is called menu-swapper input: component name (from); component name (to).
allItemsSelected(aComponent) Determines whether the user has selected all of the items in a list box. Returns true if all of the items have been selected, otherwise returns false. setItemsUnselected(aComponent) Sets all items in a particular list box as unselected. setItemsSelected(aComponent) Sets all items in a particular list box as selected. setAnItemSelected(aComponent, value) Sets a single item in a particular list box as selected. isItemSelected(aComponent, value) Determines whether a single item in a particular list box has been selected. Returns either true or false. hasItem(aComponent, item) Determines whether a single item is listed in a particular list box. Returns true if the item is in the list, otherwise returns false. isListBoxEmpty(aComponent) Determines whether a particular list box is empty. Returns true if the list box is empty, otherwise returns false. countSelected(aComponent) Determines the number of items the user has selected. It returns 0 if no items are selected, or an integer matching the number of selected items. setButtonContext(aComponent, aButton) Enables or disables a button associated with a slosh bucket list box. Input arguments include a list box and a button. If any items are selected in the list box, the button is enabled, otherwise, it is disabled. This behavior disables the remove button, for example, when no items are in the list, and therefore cannot be removed. Use this function in the onChange block of the SELECT HTML form. updateSloshBuckets(aComponent1, aButton1, aComponent2, aButton2) This function updates which buttons are enabled and disabled depending on where the user last clicked. For example, if the slosh bucket consists of two side by side lists and the user clicks on an item in the left list, this function enables the button to move the item to the right list and disables the button to move items from the right to the left list. initializeSloshBuckets(aComponent1, aButton1, aComponent2, aButton2) This function is similar to "updateSloshBuckets()" except that it is designed to be called when the page is first loaded, as part of the "onLoad" event. whichItemIsSelected(aComponent) Determines which item the user has selected in an option box. It returns the value of the first selected item found. If no items are selected, it returns an empty string.
Related concepts
Related tasks