|
Name
|
Type
|
Default
|
|
disabled
|
Boolean
|
false
|
Enables/disables the listbox.
Code example
Initialize a jqxListBox with the disabled property specified.
$('#jqxListBox').jqxListBox({ disabled: true });
|
|
width
|
String
|
null
|
Gets or sets the listbox width.
Code example
Initialize a jqxListBox with the width property specified.
$("#jqxListBox").jqxListBox({ width: '250px', height: '250px' });
|
|
height
|
String
|
null
|
Gets or sets the listbox height.
Code example
Initialize a jqxListBox with the height property specified.
$("#jqxListBox").jqxListBox({ width: '250px', height: '250px' });
|
|
theme
|
String
|
''
|
Sets the widget's theme.
jQWidgets uses a pair of css files - jqx.base.css and jqx.[theme name].css. The base stylesheet creates the styles related to the widget's layout like margin, padding, border-width, position. The second css file applies the widget's colors and backgrounds. The jqx.base.css should be included before the second CSS file.
In order to set a theme, you need to do the following:
|
|
multiple
|
Boolean
|
false
|
Enables/disables the multiple selection. When this property is set to true, the
user can select multiple items.
Code example
Initialize a jqxListBox with the multiple property specified.
$("#jqxListBox").jqxListBox({multiple: true});
|
|
multipleextended
|
Boolean
|
false
|
Enables/disables the multiple selection using Shift and Ctrl keys. When this property is set to true, the
user can select multiple items by clicking on item and holding Shift or Ctrl.
Code example
Initialize a jqxListBox with the multipleextended property specified.
$("#jqxListBox").jqxListBox({multipleextended: true});
|
|
selectedIndex
|
Number
|
-1
|
Gets or sets the selected index.
Code example
Initialize a jqxListBox with the selectedIndex property specified.
$("#jqxListBox").jqxListBox({selectedIndex: 2 });
|
|
source
|
Array
|
null
|
Gets or sets the items source.
Code example
Initialize a jqxListBox with the source property specified.
var data = [
"Affogato",
"Americano",
"Bicerin"
];
$("#jqxListBox").jqxListBox({source: data});
Binding using the jqx.dataAdapter(requires jqxdata.js):
// url of the data.
var url = "../sampledata/customers.txt";
var parentsLength = $("#jqxWidget").parents().length;
if (parentsLength > 3) {
url = 'demos/sampledata/customers.txt';
}
// prepare the data. Set the datatype to 'json', 'xml', 'tsv', 'array', 'local' or 'csv.
var source =
{
datatype: "json",
datafields: [
{ name: 'CompanyName' },
{ name: 'ContactName' }
],
id: 'id',
url: url
};
// create a new instance of the jqx.dataAdapter.
var dataAdapter = new $.jqx.dataAdapter(source);
// Create a jqxListBox
$("#jqxWidget").jqxListBox({ source: dataAdapter, displayMember: "ContactName", valueMember: "CompanyName", width: 200, height: 250, theme: theme });
|
|
displayMember
|
String
|
""
|
Sets the displayMember of the Items. The displayMember specifies the name of an object property to display. The name is contained in the collection specified by the 'source' property.
Code example
Initialize a jqxListBox with the displayMember property specified.
$("#jqxListBox").jqxListBox({displayMember: 'firstName'});
|
|
valueMember
|
String
|
""
|
Sets the valueMember of the Items. The valueMember specifies the name of an object property to set as a 'value' of the list items. The name is contained in the collection specified by the 'source' property.
Code example
Initialize a jqxListBox with the valueMember property specified.
$("#jqxListBox").jqxListBox({valueMember: 'lastName'});
|
|
clear
|
Method
|
|
Clears all items.
Code example
Invoke the clear method.
$("#jqxListBox").jqxListBox('clear');
|
|
scrollBarSize
|
Number
|
17
|
Gets or sets the scrollbars size.
Code example
Initialize a jqxListBox with the scrollBarSize property specified.
$("#jqxListBox").jqxListBox({scrollBarSize: 25});
|
|
enableHover
|
Boolean
|
true
|
Enables/disables the hover state.
Code example
Initialize a jqxListBox with the enableHover property specified.
$("#jqxListBox").jqxListBox({enableHover: false});
|
|
incrementalSearch
|
Boolean
|
true
|
Gets or sets the incrementalSearch property. An incremental search begins searching as soon as you type the first character of the search string. As you type in the search string, jqxListBox automatically selects the found item.
Code example
Initialize a jqxListBox with the incrementalSearch property specified.
$("#jqxListBox").jqxListBox({incrementalSearch: false});
|
|
incrementalSearchDelay
|
Number
|
700
|
Gets or sets the incrementalSearchDelay property. The incrementalSearchDelay specifies the time-interval in milliseconds after which the previous search string is deleted. The timer starts
when you stop typing.
Code example
Initialize a jqxListBox with the incrementalSearchDelay property specified.
$("#jqxListBox").jqxListBox({incrementalSearchDelay: 400});
|
|
searchMode
|
String
|
startswith
|
Gets or sets the item incremental search mode. When the user types some text in a focused ListBox,
the jqxListBox widget tries to find the searched item using the entered text and the selected search mode.
Possible Values: 'none, 'contains', 'containsignorecase', 'equals', 'equalsignorecase', 'startswithignorecase', 'startswith', 'endswithignorecase', 'endswith'
Code example
Initialize a jqxListBox with the searchMode property specified.
$("#jqxListBox").jqxListBox({searchMode: 'contains' });
|
|
enableSelection
|
Boolean
|
true
|
Enables/disables the selection.
Code example
Initialize a jqxListBox with the enableSelection property specified.
$("#jqxListBox").jqxListBox({enableSelection: false});
|
|
equalItemsWidth
|
Boolean
|
true
|
Gets or sets whether the items width should be equal to the listbox's width.
Code example
Initialize a jqxListBox with the equalItemsWidth property specified.
$("#jqxListBox").jqxListBox({equalItemsWidth:false});
|
|
itemHeight
|
Number
|
-1
|
Gets or sets the height of the jqxListBox Items. When the itemHeight == - 1, each
item's height is equal to its desired height.
Code example
Initialize a jqxListBox with the itemHeight property specified.
$("#jqxListBox").jqxListBox({itemHeight: 25});
|
|
checkboxes
|
Boolean
|
false
|
Gets or sets whether the listbox should display a checkbox next to each item.
Code example
Initialize a jqxListBox with the checkboxes property
specified.
$("#jqxListBox").jqxListBox({checkboxes:true});
|
|
autoHeight
|
Boolean
|
false
|
Gets or sets whether the listbox's height is equal to the sum of each item's height
Code example
Initialize a jqxListBox with the autoHeight property
specified.
$("#jqxListBox").jqxListBox({autoHeight:true});
|
|
hasThreeStates
|
Boolean
|
false
|
Gets or sets whether the checkboxes have three states - checked, unchecked and indeterminate.
Code example
Initialize a jqxListBox with the hasThreeStates property
specified.
$("#jqxListBox").jqxListBox({hasThreeStates:true});
|
|
allowDrag(requires jqxdragdrop.js)
|
Boolean
|
false
|
Enables the dragging of ListBox Items.
Code example
Initialize a jqxListBox with the allowDrag property
specified.
$("#jqxListBox").jqxListBox({allowDrag:true});
|
|
allowDrop(requires jqxdragdrop.js)
|
Boolean
|
false
|
Enables the dropping of ListBox Items.
Code example
Initialize a jqxListBox with the allowDrop property
specified.
$("#jqxListBox").jqxListBox({allowDrop:true});
|
|
dropAction(requires jqxdragdrop.js)
|
String
|
'default'.
|
Sets the drop action when an item is dropped. Possible values: 'default', 'copy' or 'none'. The 'copy' action adds a clone of the dropped item.
The 'none' action means that the dropped item will not be added to a new collection and will not be removed from its parent collection.
Code example
Initialize a jqxListBox with the dropAction property
specified.
$("#jqxListBox").jqxListBox({dropAction:'copy'});
|
|
dragStart
|
Function
|
null
|
Callback function which is called when a drag operation starts.
Code example
Set the dragStart property
$("#listbox").jqxListBox({dragStart: function (item) {
// disable dragging of 'Café au lait' item.
if (item.label == 'Café au lait')
return false;
// enable dragging for the item.
return true;
}
});
|
|
dragEnd
|
Function
|
null
|
Callback function which is called when a drag operation ends.
Code example
Set the dragEnd property
$("#listbox").jqxListBox({
dragEnd: function (dragItem, dropItem) {
// dragItem is the dragged Item.
// dropItem is the item under the mouse cursor when you dropped the dragged item.
if (dragItem.label == "Frappuccino")
return false;
}
});
|
|
renderer
|
Function
|
null
|
Callback function which is called when an item is rendered. By using the renderer function, you can customize the look of the list items.
Code example
Set the renderer property
$('#listbox').jqxListBox({renderer: function (index, label, value) {
var datarecord = data[index];
return datarecord.firstname + " " + datarecord.lastname;
}
});
|
|
|
|
select
|
Event
|
|
This event is triggered when the user selects an item.
Code example
Bind to the select event by type: jqxListBox.
$('#listbox').bind('select', function (event) {
var args = event.args;
if (args) {
var index = args.index;
var item = args.item;
var originalEvent = args.originalEvent;
// get item's label and value.
var label = item.label;
var value = item.value;
}
});
|
|
unselect
|
Event
|
|
This event is triggered when the user unselects an item.
Code example
Bind to the unselect event by type: jqxListBox.
$('#listbox').bind('unselect', function (event)
{
var args = event.args;
if (args) {
var index = args.index;
var item = args.item;
var originalEvent = args.originalEvent;
// get item's label and value.
var label = item.label;
var value = item.value;
}
});
|
|
change
|
Event
|
|
This event is triggered when the user selects an item.
Code example
Bind to the change by type: jqxListBox.
$('#listbox').bind('change', function (event) {
// the event is raised when the selection is changed.
var args = event.args;
if (args) {
var index = args.index;
var item = args.item;
var originalEvent = args.originalEvent;
// get item's label and value.
var label = item.label;
var value = item.value;
}
});
|
|
checkChange
|
Event
|
|
This event is triggered when the user checks or unchecks an item.
Code example
Bind to the checkchange event by type: jqxListBox.
$("#listbox").bind('checkChange', function (event) {
var args = event.args;
// get new check state.
var checked = args.checked;
// get the item and it's label and value fields.
var item = args.item;
var itemLabel = item.label;
var itemValue = item.value;
// get all checked items.
var checkedItems = $("#listbox").jqxListBox('getCheckedItems');
});
|
|
dragStart
|
Event
|
|
This event is triggered when the user starts a drag operation.
Code example
Bind to the dragStart event by type: jqxListBox.
$("#listBox").bind('dragStart', function (event) {
var args = event.args;
var label = args.label;
var value = args.value;
var originalEvent = args.originalEvent;
});
|
|
dragEnd
|
Event
|
|
This event is triggered when the user drops an item.
Code example
Bind to the dragEnd event by type: jqxListBox.
$("#listBox").bind('dragEnd', function (event) {
var args = event.args;
var label = args.label;
var value = args.value;
var originalEvent = args.originalEvent;
});
|
|
bindingComplete
|
Event
|
|
This event is triggered when the data binding operation is completed.
Code example
Bind to the bindingComplete event by type: jqxListBox.
$("#listBox").bind('bindingComplete', function (event) {
});
|
|
|
|
addItem
|
Method
|
|
Adds a new item to the jqxListBox. Returns 'true', if the new item is added or false if the item is not added.
Code example
Invoke the addItem method.
// @param String
$("#jqxListBox").jqxListBox('addItem', 'jQuery' );
|
|
insertAt
|
Method
|
|
Inserts a new item to the jqxListBox. Returns 'true', if the new item is inserted or false if the insertaion fails.
Code example
Invoke the insertAt method.
// @param String
// @param Number
$("#jqxListBox").jqxListBox('insertAt', 'jQuery', 1 );
|
|
removeAt
|
Method
|
|
Removes an item from the listbox. Index is a number of the item to remove. Returns true, if the item is removed or false, if the
item is not removed.
Code example
Invoke the removeAt method.
// @param Number
$("#jqxListBox").jqxListBox('removeAt', 3 );
|
|
disableAt
|
Method
|
|
Disables an item by index. Index is a number.
Code example
Invoke the disableAt method.
// @param Number
$("#jqxListBox").jqxListBox('disableAt', 8 );
|
|
enableAt
|
Method
|
|
Enables a disabled item by index. Index is a number.
Code example
Invoke the enableAt method.
// @param Number
$("#jqxListBox").jqxListBox('enableAt', 3 );
|
|
getItems
|
Method
|
|
Gets all ListBox items.
Code example
Invoke the getItems method.
var items = $("#jqxListBox").jqxListBox('getItems');
|
|
getSelectedItems
|
Method
|
|
Gets the selected ListBox items.
Code example
Invoke the getSelectedItems method.
var items = $("#jqxListBox").jqxListBox('getSelectedItems');
|
|
getCheckedItems
|
Method
|
|
Gets the checked ListBox items.
Code example
Invoke the getCheckedItems method.
var items = $("#jqxListBox").jqxListBox('getCheckedItems');
|
|
ensureVisible
|
Method
|
|
Ensures that an item is visible. index is number. If necessary scrolls to the item.
Code example
Invoke the ensureVisible method.
// @param Number
$("#jqxListBox").jqxListBox('ensureVisible', 2 );
|
|
getItem
|
Method
|
|
Gets an item by index.
Item Fields
- label - gets item's label.
- value - gets the item's value.
- disabled - gets whether the item is enabled/disabled.
- checked - gets whether the item is checked/unchecked.
- hasThreeStates - determines whether the item's checkbox supports three states.
- html - gets the item's display html. This can be used instead of label.
- index - gets the item's index.
- group - gets the item's group.
Code example
Invoke the getItem method.
// @param Number
var item = $("#jqxListBox").jqxListBox('getItem', 1 );
|
|
getItemByValue
|
Method
|
|
Gets an item by its value.
Item Fields
- label - gets item's label.
- value - gets the item's value.
- disabled - gets whether the item is enabled/disabled.
- checked - gets whether the item is checked/unchecked.
- hasThreeStates - determines whether the item's checkbox supports three states.
- html - gets the item's display html. This can be used instead of label.
- index - gets the item's index.
- group - gets the item's group.
Code example
Invoke the getItemByValue method.
// @param Value
var item = $("#jqxWidget").jqxListBox('getItemByValue', "Bon app'");
|
|
getSelectedItem
|
Method
|
|
Gets the selected item.
Code example
Invoke the getSelectedItem method.
// @param Number
var item = $("#jqxListBox").jqxListBox('getSelectedItem');
|
|
getSelectedIndex
|
Method
|
|
Gets the index of the selected item.
Code example
Invoke the getSelectedIndex method.
// @param Number
var index = $("#jqxListBox").jqxListBox('getSelectedIndex');
|
|
selectIndex
|
Method
|
|
Selects item. Index is number .
Code example
Invoke the selectIndex method.
// @param Number
$("#jqxListBox").jqxListBox('selectIndex', 0 );
|
|
unselectIndex
|
Method
|
|
Unselects item by index.
Code example
Invoke the unselectIndex method.
// @param Number
$("#jqxListBox").jqxListBox('unselectIndex', 5 );
|
|
selectItem
|
Method
|
|
Selects an item.
Code example
Invoke the selectItem method.
// @param jqxListBox Item
$("#jqxListBox").jqxListBox('selectItem', item );
*To get an item, use the getItem or getItemByValue methods.
|
|
unselectItem
|
Method
|
|
Unselects an item.
Code example
Invoke the unselectItem method.
// @param jqxListBox Item
$("#jqxListBox").jqxListBox('unselectItem', item );
*To get an item, use the getItem or getItemByValue methods.
|
|
clearSelection
|
Method
|
|
Clears all selected items.
Code example
Invoke the clearSelection method.
$("#jqxListBox").jqxListBox('clearSelection');
|
|
checkIndex
|
Method
|
|
Checks a list item when the 'checkboxes' property value is true.
Code example
Invoke the 'checkIndex' method.
$("#jqxListBox").jqxListBox('checkIndex', 0);
|
|
uncheckIndex
|
Method
|
|
Unchecks a list item when the 'checkboxes' property value is true.
Code example
Invoke the 'uncheckIndex' method.
$("#jqxListBox").jqxListBox('uncheckIndex', 0);
|
|
indeterminateIndex
|
Method
|
|
indeterminates a list item when the 'checkboxes' property value is true.
Code example
Invoke the 'indeterminateIndex' method.
$("#jqxListBox").jqxListBox('indeterminateIndex', 0);
|
|
checkItem
|
Method
|
|
Checks an item.
Code example
Invoke the checkItem method.
// @param jqxListBox Item
$("#jqxListBox").jqxListBox('checkItem', item );
*To get an item, use the getItem or getItemByValue methods.
|
|
uncheckItem
|
Method
|
|
Unchecks an item.
Code example
Invoke the uncheckItem method.
// @param jqxListBox Item
$("#jqxListBox").jqxListBox('uncheckItem', item );
*To get an item, use the getItem or getItemByValue methods.
|
|
indeterminateItem
|
Method
|
|
Indeterminates an item.
Code example
Invoke the indeterminateItem method.
// @param jqxListBox Item
$("#jqxListBox").jqxListBox('indeterminateItem', item );
*To get an item, use the getItem or getItemByValue methods.
|
|
checkAll
|
Method
|
|
Checks all list items when the 'checkboxes' property value is true.
Code example
Invoke the 'checkAll' method.
$("#jqxListBox").jqxListBox('checkAll');
|
|
uncheckAll
|
Method
|
|
Unchecks all list items when the 'checkboxes' property value is true.
Code example
Invoke the 'uncheckAll' method.
$("#jqxListBox").jqxListBox('uncheckAll');
|
|
beginUpdate
|
Method
|
|
Stops the ListBox's rendering. That method is usually used when multiple items need to be inserted or removed dynamically.
Code example
Invoke the 'beginUpdate' method.
$("#jqxListBox").jqxListBox('beginUpdate');
|
|
endUpdate
|
Method
|
|
Starts the ListBox's rendering and refreshes the ListBox. That method is usually used in combination with the 'beginUpdate' method when multiple items need to be inserted or removed dynamically.
Code example
Invoke the 'endUpdate' method.
$("#jqxListBox").jqxListBox('endUpdate');
|
|
focus
|
Method
|
|
Sets the focus to the jqxListBox.
Code example
Invoke the 'focus' method.
$("#jqxListBox").jqxListBox('focus');
|
|
render
|
Method
|
|
Renders the jqxListBox widget.
Code example
Invoke the render method.
$('#listbox').jqxListBox('render');
|
|
refresh
|
Method
|
|
Refreshes the jqxListBox widget. The refresh method will update the jqxListBox's layout, size and data.
Code example
Invoke the refresh method.
$('#listbox').jqxListBox('refresh');
|
|
invalidate
|
Method
|
|
The invalidate method will repaint the jqxListBox's items.
Code example
Invoke the invalidate method.
$('#listbox').jqxListBox('invalidate');
|
|
destroy
|
Method
|
|
Destroy the jqxListBox widget. The destroy method removes the jqxListBox widget from the web page.
Code example
Invoke the destroy method.
$('#listbox').jqxListBox('destroy');
|