tmt:linkedselect

tmt:linkedselect is a JavaScript widget that enhance an XHTML <select> element. Optionally, it can be integrated with Spry dataset.

tmt:linkedselect has multiple purposes:

In order to use this library you need tmt_core.js and tmt_spry_linkedselect.js. To use binding you need the Spry framework.

Samples

Syntax reference

tmt:linkedselect This attribute must be set to true in order to enable the library. This is the only required attribute
tmt:binding Name of the Spry's dataset used for binding
tmt:bindingvalue Name of the dataset's field used to set <select> value. Requires tmt:binding
tmt:bindingtext Name of the dataset's field used for set <select> text. Requires tmt:binding
tmt:targetselect Id of the <select> that will depend on this one
tmt:resetonvalue Use this attribute if you want to reset the <select> as soon as the specified value is selected
tmt:autoload Set this to "false" if you don't want to display data from dataset as soon as the page loads. Data will be displayed only as soon another <select> triggers the current one
tmt:defaultselected Use this attribute if you want to select by default a given value. Typically used for updating data

API

tmt.spry.linkedselect.util.addOption(selectId, text, value) Add an option to a given linkedselect. Third argument is optional (see sample)
tmt.spry.linkedselect.util.copyOptions(sourceId, destinationId) Copy currently selected options from a given linkedselect to another (see sample)
tmt.spry.linkedselect.util.moveOptions(sourceId, destinationId) Move currently selected options from a given linkedselect to another (see sample)
tmt.spry.linkedselect.util.moveOptionDown(selectId) Move currently selected options down by a position (see sample)
tmt.spry.linkedselect.util.moveOptionUp(selectId) Move currently selected options up by a position (see sample)
tmt.spry.linkedselect.util.removeOption(selectId) Remove currently selected options (see sample)
tmt.spry.linkedselect.util.resetSelect(selectId) Reset a sprylinkedselect loading only its hardcoded options (see sample)
tmt.spry.linkedselect.util.setBinding(selectId, datasetName) Point a linkedselect to a new dataset for binding (see sample)
tmt.spry.linkedselect.util.sortSelect(selectId) Sort the options of a given linkedselect based on their text (see sample)