jQuery.fn.glowLookUptextBox
This plugin presents an auto-completing textbox that allows for single or multiple selections
Usage
Initiate a selection of text input elements to be lookup text boxes
$('selector').glowLookUpTextBox(options)
where selector contains <input type="text" />
element(s) and options
is an optional object argument
Options
-
delimiter
: delimiter to insert between selected items when multiple items are allowed and to use when- default:
','
- default:
-
allowDuplicates
: boolean value of whether or not multiple same items can be selected- default:
false
- default:
-
maxValues
: maximum number of selectable items per control- default:
0
- default:
-
onGetLookUps
: callback function which is passed both the current lookup text box instance and the currently-typed text. Typically used to perform an ajax callback and then populate the textbox with available matching options.- default:
null
- default:
-
emptyHtml
: string displayed when no selection is made- default: empty string
-
selectedLookUpsHtml
: array of strings to pre-populate as selected- default:
[]
- default:
-
deleteImageUrl
: URL of image to render within selected options which acts as a trigger for deleting the selected option- default: empty string
-
lookUpPopUpHeight
: Height, in pixels of the suggestion pop-up- default: 200
Events
glowLookUpTextBoxChange
: triggered when the value is changed
Methods
disabled
Gets and/or sets whether the lookup text box is disabled
var disabled = $('selector').glowLookUpTextBox('disabled');
$('selector').glowLookUpTextBox('disabled', false);
updateSuggestions
Sets the current list of autocompletion suggestions. Often used after a successful Ajax callback.
var suggestions = ["abc", "def", "ghi"];
$('selector').glowLookUpTextBox('updateSuggestions', suggestions);
removeByIndex
Removes a current selection by index
$('selector').glowLookUpTextBox('removeByIndex', 3);
removeByValue
Removes a current selection by value
$('selector').glowLookUpTextBox('removeByValue', 'value');
add
Adds a selected value
var lookup = $('selector').glowLookUpTextBox('createLookup', 'value', 'selected html', 'suggested html', true);
$('selector').glowLookUpTextBox('removeByValue', lookup);
getByIndex
Gets the a selected lookup by index
var selectedLookup = $('selector').glowLookUpTextBox('getByIndex', 2);
count
Gets the count of selected lookups
var count = $('selector').glowLookUpTextBox('count');
getCurrentSearchText
Gets the current search text
var text = $('selector').glowLookUpTextBox('getCurrentSearchText');
createLookUp
Manually creates a new lookup object suitable for adding as a selected lookup
var lookup = $('selector').glowLookUpTextBox('createLookup', 'value', 'selected html', 'suggested html', true);