Skip to content

Latest commit

 

History

History
3306 lines (2350 loc) · 54.7 KB

File metadata and controls

3306 lines (2350 loc) · 54.7 KB
layout post
title Properties,Methods and Events of Essential JS ejListBox Widget
description What are the options, methods and events available in Essential JavaScript ListBox.
documentation API
keywords ejListBox, API, Essential JS ListBox, ListBox
platform angular-api
metaname
metacontent

ejListBox

The ListBox control provides a list of options for users to select from. It is capable of including other HTML elements such as images, textboxes, check box, and radio buttons and so on. It also supports data binding, template options, multi-select options, etc.

Syntax:

$(element).ejListBox(options)

Example: {:.example}

allowDrop boolean

{:#members:allowdrop}

Accepts the items which are dropped in to it, when it is set to true.

N> Need to enable allowDrag property to drag the list item from the listbox control.

Default Value:

  • false

Example {:.example}

{% highlight js %}

        $("#list").ejListBox({
            allowDrop: true
        });

{% endhighlight %}

allowMultiSelection boolean

{:#members:allowmultiselection}

Enables or disables multiple selection.

Default Value:

  • false

Example {:.example}

{% highlight js %}

$('#list').ejListBox({allowMultiSelection: true}); 

{% endhighlight %}

allowVirtualScrolling boolean

{:#members:allowvirtualscrolling}

Loads the list data on demand via scrolling behavior to improve the application’s performance. There are two ways to load data which can be defined using “virtualScrollMode” property.

Default Value:

  • false

Example {:.example}

{% highlight js %}

        $("#customerList").ejListBox({

        allowVirtualScrolling: true           

          });

{% endhighlight %}

caseSensitiveSearch boolean

{:#members:casesensitivesearch}

Enables or disables the case sensitive search for list item by typing the text (search) value.

N> It works only when the enableIncrementalSearch is set as true.

Default Value:

  • false

Example {:.example}

{% highlight js %}

$('#list').ejListBox({

    enableIncrementalSearch: true,

    caseSensitiveSearch: true

});

{% endhighlight %}

cascadeTo string

{:#members:cascadeto}

Dynamically populate data of a list box while selecting an item in another list box i.e. rendering child list box based on the item selection in parent list box. This property accepts the id of the child ListBox widget to populate the data.

Default Value:

  • null

Example {:.example}

{% highlight js %}

$('#list').ejListBox({

cascadeTo: 'countryList'

});

{% endhighlight %}

checkedIndices Array

{:#members:checkedindices}

Set of list items to be checked by default using its index. It works only when the showCheckbox property is set to true.

Default Value:

  • null

Example {:.example}

{% highlight js %}

    $('#list').ejListBox({ showCheckbox: true, checkedIndices: [2,3] });

{% endhighlight %}

cssClass string

{:#members:cssclass}

The root class for the ListBox widget to customize the existing theme.

Default Value:

  • “”

Example {:.example}

{% highlight js %}

    $("#list").ejListBox({ cssClass: 'gradient-lime' });

{% endhighlight %}

dataSource Object

{:#members:datasource}

Contains the list of data for generating the list items.

Default Value:

  • null

Example {:.example}

{% highlight js %}

        $("#customerList").ejListBox({

            dataSource: customerData

        });

{% endhighlight %}

enabled boolean

{:#members:enabled}

Enables or disables the ListBox widget.

Default Value:

  • true

Example {:.example}

{% highlight js %}

$('#list').ejListBox({enabled : false }); 

{% endhighlight %}

enableIncrementalSearch boolean

{:#members:enableincrementalsearch}

Enables or disables the search behavior to find the specific list item by typing the text value.

Default Value:

  • false

Example {:.example}

{% highlight js %}

$('#list').ejListBox({enableIncrementalSearch : true}); 

{% endhighlight %}

enablePersistence boolean

{:#members:enablepersistence}

Allows the current model values to be saved in local storage or browser cookies for state maintenance when it is set to true.

N> Local storage is supported only in Html5 supported browsers. If the browsers don’t have support for local storage, browser cookies will be used to maintain the state.

Default Value:

  • false

Example {:.example}

{% highlight js %}

$('#list').ejListBox({enablePersistence : false}); 

{% endhighlight %}

enableRTL boolean

{:#members:enablertl}

Displays the ListBox widget’s content from right to left when enabled.

Default Value:

  • false

Example {:.example}

{% highlight js %}

$('#list').ejListBox({enableRTL : true }); 

{% endhighlight %}

enableWordWrap boolean

{:#members:enablewordwrap}

Specifies ellipsis ("...") representation in an overflowed list item content when it is set to false.

Default Value:

  • true

Example {:.example}

{% highlight js %}

$('#list').ejListBox({enableWordWrap : false }); 

{% endhighlight %}

fields Object

{:#members:fields}

Mapping fields for the data items of the ListBox widget.

Default Value:

  • null

Example {:.example}

{% highlight js %}

$("#countryList").ejListBox({

dataSource: countries,

fields: {
    text: "name",
    value: "key"
}

});

{% endhighlight %}

fields.checkBy boolean

{:#members:fields-checkBy}

Defines the specific field name which contains Boolean values to specify whether the list items to be checked by default or not.

fields.groupBy string

{:#members:fields-groupBy}

The grouping in the ListBox widget can be defined using this field.

fields.htmlAttributes Object

{:#members:fields-htmlAttributes}

Defines the HTML attributes such as id, class, styles for the specific ListBox item.

fields.id string

{:#members:fields-id}

Defines the specific field name which contains id values for the list items.

fields.imageUrl string

{:#members:fields-imageUrl}

Defines the imageURL for the image to be displayed in the ListBox item.

fields.imageAttributes string

{:#members:fields-imageAttributes}

Defines the image attributes such as height, width, styles and so on.

fields.selectBy boolean

{:#members:fields-selectBy}

Defines the specific field name which contains Boolean values to specify whether the list items to be selected by default or not.

fields.spriteCssClass string

{:#members:fields-spriteCssClass}

Defines the sprite CSS class for the image to be displayed.

fields.tableName string

{:#members:fields-tableName}

Defines the table name to get the specific set of list items to be loaded in the ListBox widget while rendering with remote data.

fields.text string

{:#members:fields-text}

Defines the specific field name in the data source to load the list with data.

fields.value string

{:#members:fields-value}

Defines the specific field name in the data source to load the list with data value property.

height string

{:#members:height}

Defines the height of the ListBox widget.

Default Value:

  • null

Example {:.example}

{% highlight js %}

$('#list').ejListBox({ height: "300"}); 

{% endhighlight %}

itemHeight string

{:#members:itemheight}

Defines the height for individual ListBox item.

Default Value:

  • null

Example {:.example}

{% highlight js %}

BikeList = [
    { employeeId: "bk1", text: "Apache RTR" }, { employeeId: "bk2", text: "CBR 150-R" }, { employeeId: "bk3", text: "CBZ Xtreme" },
    { employeeId: "bk4", text: "Discover" }, { employeeId: "bk5", text: "Dazzler" }, { employeeId: "bk6", text: "Flame" },
    { employeeId: "bk7", text: "Fazer" }, { employeeId: "bk8", text: "FZ-S" }, { employeeId: "bk9", text: "Pulsar" },
    { employeeId: "bk10", text: "Shine" }, { employeeId: "bk11", text: "R15" }, { employeeId: "bk12", text: "Unicorn" }
];

$("#selectBike").ejListBox({
    dataSource: BikeList, itemHeight:"40px",
    fields: { id: "employeeId", value: "text" }
});

{% endhighlight %}

itemsCount number

{:#members:itemscount}

The number of list items to be shown in the ListBox widget. The remaining list items will be scrollable.

Default Value:

  • null

Example {:.example}

{% highlight js %}

$('#list').ejListBox({itemsCount: 8}); 

{% endhighlight %}

totalItemsCount number

{:#members:totalitemscount}

The total number of list items to be rendered in the ListBox widget.

N> It’s dependent on datasource property.

Default Value:

  • null

Example {:.example}

{% highlight js %}

$('#list').ejListBox({totalItemsCount: 8});

{% endhighlight %}

itemRequestCount number

{:#members:itemrequestcount}

The number of list items to be loaded in the list box while enabling virtual scrolling and when virtualScrollMode is set to continuous.

Default Value:

  • 5

Example {:.example}

{% highlight js %}

$("#customerList").ejListBox({

itemRequestCount: 6

});

{% endhighlight %}

loadDataOnInit boolean

{:#members:loaddataoninit}

Loads data for the listbox by default (i.e. on initialization) when it is set to true. It creates empty ListBox if it is set to false.

N> It is used along with cascading feature. See also cascadeTo.

Default Value: true

Example {:.example}

{% highlight js %}

    $('#countryList').ejListBox({ 

        loadDataOnInit: false 

    });

{% endhighlight %}

query ej.Query

{:#members:query}

The query to retrieve required data from the data source.

Default Value:

  • ej.Query()

Example {:.example}

{% highlight js %}

var query = ej.Query()

.from("Customers").take(10);

$("#customerList").ejListBox({

query: query

});

{% endhighlight %}

selectedIndex number

{:#members:selectedindex}

The list item to be selected by default using its index.

Default Value:

  • null

Example {:.example}

{% highlight js %}

$('#list').ejListBox({selectedIndex : 2}); 

{% endhighlight %}

selectedIndices Array

{:#members:selectedindices}

The list items to be selected by default using its indices. To use this property allowMultiSelection should be enabled.

Default Value:

  • []

Example {:.example}

{% highlight js %}

$('#list').ejListBox({selectedIndices : [2,4]}); 

{% endhighlight %}

showCheckbox boolean

{:#members:showcheckbox}

Enables/Disables the multi selection option with the help of checkbox control.

Default Value:

  • false

Example {:.example}

{% highlight js %}

$('#list').ejListBox({showCheckbox: true }); 

{% endhighlight %}

showRoundedCorner boolean

{:#members:showroundedcorner}

To display the ListBox container with rounded corners.

Default Value:

  • false

Example {:.example}

{% highlight js %}

$('#list').ejListBox({ showRoundedCorner: true }); 

{% endhighlight %}

sortOrder enum

{:#members:sortOrder}

Set to sort ListBox items either by Ascending or Descending order. By default sortOrder is set as enum type of "None". You can use only below mentioned type for sorting purpose.

Name Description
None The items are not sorted.
Ascending To sort items in Ascending order.
Descending To sort items in Descending order.

Default Value

  • ej.SortOrder.None

Example {:.example}

{% highlight js %}

$('#list').ejListBox({ sortOrder: ej.SortOrder.Ascending }); 

{% endhighlight %}

template string

{:#members:template}

The template to display the ListBox widget with customized appearance.

Default Value:

  • null

Example {:.example}

{% highlight js %}

        $('#selectExperts').ejListBox({

            template: '<div class="bike-name"> ${text} </div><div class="design"> ${design} </div><div class="cont"> ${country} </div>'

        });

{% endhighlight %}

value number

{:#members:value}

Holds the selected items values and used to bind value to the list item using AngularJS and KnockoutJS.

Default Value:

  • “”

Example {:.example}

virtualScrollMode enum

{:#members:virtualscrollmode}

Specifies the virtual scroll mode to load the list data on demand via scrolling behavior. There are two types of mode.

Name

Description

continuous

Each time when we scroll to the end of the ListBox widget, the other set of list items will get loaded.

normal

This mode allows you to load the list box data while scrolling i.e. each time the scroll bar is scrolled, it will send request to the server to load the data.

Default Value:

  • ej.VirtualScrollMode.Normal

Example {:.example}

{% highlight js %} $("#customerList").ejListBox({

                allowVirtualScrolling: true, 
        
        virtualScrollMode: "continuous"           
        
        });

{% endhighlight %}

width string

{:#members:width}

Defines the width of the ListBox widget.

Default Value:

  • null

Example {:.example}

{% highlight js %}

$('#list').ejListBox({ width: "220"}); 

{% endhighlight %}

targetID string

{:#members:targetid}

Specifies the targetID for the listbox items.

Default Value: null

Example {:.example}

{% highlight js %}

$('#list').ejListBox({ targetID: "carsList"}); 

{% endhighlight %}

Methods

addItem(listItem, index)

{:#methods:additem}

Adds a given list items in the ListBox widget at a specified index. It accepts two parameters.

Parameters Type Description
listItem Object |string This can be a list item object (for JSON binding) or a string (for UL and LI rendering). Also we can the specify this as an array of list item object or an array of strings to add multiple items.
index number The index value to add the given items at the specified index. If index is not specified, the given items will be added at the end of the list.

Example {:.example}

{% highlight js %}

    $('#list').ejListBox("addItem","Audi R8",1); 

{% endhighlight %}

checkAll()

{:#methods:checkall}

Checks all the list items in the ListBox widget. It is dependent on showCheckbox property.

N> This method does not accept any arguments.

Example {:.example}

{% highlight js %}

    $('#list').ejListBox("checkAll"); 

{% endhighlight %}

checkItemByIndex(Index)

{:#methods:checkitembyindex}

Checks a list item by using its index. It is dependent on showCheckbox property.

Parameters Type Description
index number Index of the listbox item to be checked. If index is not specified, the given items will be added at the end of the list.

Example {:.example}

{% highlight js %}

    $('#list').ejListBox("checkItemByIndex",3); 

{% endhighlight %}

checkItemsByIndices(indices)

{:#methods:checkitemsbyindices}

Checks multiple list items by using its index values. It is dependent on showCheckbox property.

Parameters Type Description
indices number[] Index/Indices of the listbox items to be checked. If index is not specified, the given items will be added at the end of the list.

N> This method accepts array of integers or a string containing integer values separated by commas as an argument.

Example {:.example}

{% highlight js %}

    $('#list').ejListBox("checkItemsByIndices","2,3");

{% endhighlight %}

disable()

{:#methods:disable}

Disables the ListBox widget.

N> This method does not accept any arguments.

Example {:.example}

{% highlight js %}

    $('#list').ejListBox("disable"); 

{% endhighlight %}

disableItem(text)

{:#methods:disableitem}

Disables a list item by passing the item text as parameter.

Parameters Type Description
text string Text of the listbox item to be disabled.

Example {:.example}

{% highlight js %}

    $('#list').ejListBox("disableItem","Audi A5"); 

{% endhighlight %}

disableItemByIndex(index)

{:#methods:disableitembyindex}

Disables a list Item using its index value.

Parameters Type Description
index number Index of the listbox item to be disabled.

Example {:.example}

{% highlight js %}

    $('#list').ejListBox("disableItemByIndex" ,3); 

{% endhighlight %}

disableItemsByIndices(indices)

{:#methods:disableitemsbyindices}

Disables set of list Items using its index values.

Parameters Type Description
Indices number[] | string Indices of the listbox items to be disabled.

Example {:.example}

{% highlight js %}

    $('#list').ejListBox("disableItemsByIndices" ,"3,5,7"); 

{% endhighlight %}

enable()

{:#methods:enable}

Enables the ListBox widget when it is disabled.

Example {:.example}

{% highlight js %}

        $('#list').ejListBox("enable");

{% endhighlight %}

enableItem(text)

{:#methods:enableitem}

Enables a list Item using its item text value.

Parameters Type Description
text string Text of the listbox item to be enabled.

Example {:.example}

{% highlight js %}

        $('#list').ejListBox("enableItem", "Audi A5");

{% endhighlight %}

enableItemByIndex(index)

{:#methods:enableitembyindex}

Enables a list item using its index value.

Parameters Type Description
index number Index of the listbox item to be enabled.

Example {:.example}

{% highlight js %}

        $('#list').ejListBox("enableItemByIndex", 5);

{% endhighlight %}

enableItemsByIndices(indices)

{:#methods:enableitemsbyindices}

Enables a set of list Items using its index values.

Parameters Type Description
indices number[] | string Indices of the listbox items to be enabled.

Example {:.example}

{% highlight js %}

    $('#list').ejListBox("enableItemsByIndices", "3,5");

{% endhighlight %}

getCheckedItems()

{:#methods:getcheckeditems}

Returns the list of checked items in the ListBox widget. It is dependent on showCheckbox property.

N> This method does not accept any arguments.

Returns: object

Example {:.example}

{% highlight js %}

    $('#list').ejListBox("getCheckedItems");

{% endhighlight %}

getSelectedItems()

{:#methods:getselecteditems}

Returns the list of selected items in the ListBox widget.

N> This method does not accept any arguments.

Returns: object

Example {:.example}

{% highlight js %}

    $('#list').ejListBox("getSelectedItems");

{% endhighlight %}

getIndexByText(text)

{:#methods:getindexbytext}

Returns an item’s index based on the given text.

Parameters Type Description
text string The list item text (label)

Returns: number

Example {:.example}

{% highlight js %}

    $('#list').ejListBox("getIndexByText", "Audi A5");

{% endhighlight %}

getIndexByValue(value)

{:#methods:getindexbyvalue}

Returns an item’s index based on the value given.

Parameters Type Description
indices string The list item’s value

Returns: number

Example {:.example}

{% highlight js %}

    $('#list').ejListBox("getIndexByValue", "audia4");

{% endhighlight %}

getTextByIndex()

{:#methods:gettextbyindex}

Returns an item’s text (label) based on the index given.

Parameters Type Description
index number The list item index.

Returns: string

Example {:.example}

{% highlight js %}

        $('#list').ejListBox("getTextByIndex", 3);

{% endhighlight %}

getItemByIndex()

{:#methods:getitembyindex}

Returns a list item’s object using its index.

Parameters Type Description
index number The list item index.

Returns: object

Example {:.example}

{% highlight js %}

        $('#list').ejListBox("getItemByIndex", 3);

{% endhighlight %}

getItemByText(text)

{:#methods:getitembytext}

Returns a list item’s object based on the text given.

Parameters Type Description
text string The list item text.

Returns: object

Example {:.example}

{% highlight js %}

        $('#list').ejListBox("getItemByText", "Audi A7");

{% endhighlight %}

mergeData(data)

{:#methods:mergedata}

Merges the given data with the existing data items in the listbox.

Parameters Type Description
data Array Data to merge in listbox.

Example {:.example}

moveDown()

{:#methods:movedown}

Selects the next item based on the current selection.

N> This method does not accept any arguments.

Example {:.example}

{% highlight js %}

        $('#list').ejListBox("moveDown");

{% endhighlight %}

moveUp()

{:#methods:moveup}

Selects the previous item based on the current selection.

N> This method does not accept any arguments.

Example {:.example}

{% highlight js %}

        $('#list').ejListBox("moveUp");

{% endhighlight %}

refresh(refreshData)

{:#methods:refresh}

Refreshes the ListBox widget.

Parameters Type Description
refreshData boolean Refreshes both the datasource and the dimensions of the ListBox widget when the parameter is passed as true, otherwise only the ListBox dimensions will be refreshed.

Example {:.example}

{% highlight js %}

            $("#customerList").ejListBox("refresh", true);

{% endhighlight %}

removeAll()

{:#methods:removeall}

Removes all the list items from listbox.

N> This method does not accept any arguments.

Example {:.example}

{% highlight js %}

        $('#list').ejListBox("removeAll");

{% endhighlight %}

removeSelectedItems()

{:#methods:removeselecteditems}

Removes the selected list items from the listbox.

N> This method does not accept any arguments.

Example {:.example}

{% highlight js %}

        $('#list').ejListBox("removeSelectedItems");

{% endhighlight %}

removeItemByText(text)

{:#methods:removeitembytext}

Removes a list item by using its text.

Parameters Type Description
text string Text of the listbox item to be removed.

Example {:.example}

{% highlight js %}

        $('#list').ejListBox("removeItemByText","Audi A5");

{% endhighlight %}

removeItemByIndex(index)

{:#methods:removeitembyindex}

Removes a list item by using its index value.

Parameters Type Description
index number Index of the listbox item to be removed.

Example {:.example}

{% highlight js %}

        $('#list').ejListBox("removeItemByIndex", 2);

{% endhighlight %}

selectAll

{:#methods:selectall}

Selects all the list items dynamically. This method will works when the allowMultiSelection property is set as true.

N> This method does not accept any arguments.

Example {:.example}

{% highlight js %}

        $('#list').ejListBox("selectAll");

{% endhighlight %}

selectItemByText(text)

{:#methods:selectItemByText}

Selects the list item using its text value.

Parameters Type Description
text string Text of the listbox item to be selected.

Example {:.example}

{% highlight js %}

        $('#list').ejListBox("selectItemByText", "Audi A5");

{% endhighlight %}

selectItemByValue(value)

{:#methods:selectitembyvalue}

Selects list item using its value property.

Parameters Type Description
value string Value of the listbox item to be selected.

Example {:.example}

{% highlight js%}

        $('#list').ejListBox("selectItemByValue", "Audi A5");

{% endhighlight %}

selectItemByIndex(index)

{:#methods:selectitembyindex}

Selects list item using its index value.

Parameters Type Description
index number Index of the listbox item to be selected.

Example {:.example}

{% highlight js%}

        $('#list').ejListBox("selectItemByIndex", 2);

{% endhighlight %}

selectItemsByIndices(indices)

{:#methods:selectitemsbyindices}

Selects a set of list items through its index values.

Parameters Type Description
Indices number|number[] Index/Indices of the listbox item to be selected.

Example {:.example}

{% highlight js%}

        $('#list').ejListBox("selectItemsByIndices", "2,3,5");

{% endhighlight %}

uncheckAll()

{:#methods:uncheckall}

Unchecks all the checked list items in the ListBox widget. To use this method showCheckbox property to be set as true.

N> This method does not accept any arguments.

Example {:.example}

{% highlight js%}

        $('#list').ejListBox("uncheckAll");

{% endhighlight %}

uncheckItemByIndex(index)

{:#methods:uncheckitembyindex}

Unchecks a checked list item using its index value. To use this method showCheckbox property to be set as true.

Parameters Type Description
index number Index of the listbox item to be unchecked.

Example {:.example}

{% highlight js%}

        $('#list').ejListBox("uncheckItemByIndex", 3);

{% endhighlight %}

uncheckItemsByIndices(indices)

{:#methods:uncheckitemsbyindices}

Unchecks the set of checked list items using its index values. To use this method showCheckbox property must be set to true.

Parameters Type Description
indices number[] | string Indices of the listbox item to be unchecked.

Example {:.example}

{% highlight js%}

        $('#list').ejListBox("uncheckItemsByIndices", "2,3,5");

{% endhighlight %}

unselectAll

{:#methods:unselectall}

Unselect all the selected list items in the ListBox widget.

N> This method does not accept any arguments.

Example {:.example}

{% highlight js%}

        $('#list').ejListBox("unselectAll");

{% endhighlight %}

unselectItemByIndex(index)

{:#methods:unselectitembyindex}

Unselects a selected list item using its index value

Parameters Type Description
index number Index of the listbox item to be unselected.

Example {:.example}

{% highlight js%}

        $('#list').ejListBox("unselectItemByIndex", 2);

{% endhighlight %}

unselectItemByText(text)

{:#methods:unselectitembytext}

Unselects a selected list item using its text value.

Parameters Type Description
text string Text of the listbox item to be unselected.

Example {:.example}

{% highlight js%}

        $('#list').ejListBox("unselectItemByText", "Audi A5");

{% endhighlight %}

unselectItemByValue(value)

{:#methods:unselectitembyvalue}

Unselects a selected list item using its value.

Parameters Type Description
value string Value of the listbox item to be unselected.

Example {:.example}

{% highlight js%}

        $('#list').ejListBox("unselectItemByValue", "Audi A5");

{% endhighlight %}

unselectItemsByIndices(indices)

{:#methods:unselectitemsbyindices}

Unselects a set of list items using its index values.

Parameters Type Description
indices number[] | string Indices of the listbox item to be unselected.

N> This method accepts array of integers or a string containing list of integer values separated by commas as an argument.

Example {:.example}

{% highlight js%}

        $('#list').ejListBox("unselectItemsByIndices", "2,3,5");

{% endhighlight %}

hideCheckedItems ()

{:#methods:hidecheckeditems}

Hides all the checked items in the listbox.

N> This method does not accept any arguments.

Example {:.example}

{% highlight js%}

        $('#list').ejListBox("hideCheckedItems");

{% endhighlight %}

showItemByIndices(indices)

{:#methods:showitembyindices}

Shows a set of hidden list Items using its index values.

Parameters Type Description
indices number[] | string Indices of the listbox items to be shown.

Example {:.example}

{% highlight js%}

        $('#list').ejListBox("showItemsByIndices", "1,2,3");

{% endhighlight %}

hideItemsByIndices(indices)

{:#methods:hideitemsbyindices}

Hides a set of list Items using its index values.

Parameters Type Description
indices number[] | string Indices of the listbox items to be hidden.

Example {:.example}

{% highlight js%}

        $('#list').ejListBox("hideItemsByIndices", "1,2,3");

{% endhighlight %}

showItemsByValues(values)

{:#methods:showitemsbyvalues}

Shows the hidden list items using its values.

Parameters Type Description
values Array Values of the listbox items to be shown.

Example {:.example}

{% highlight js%}

        $('#list').ejListBox("showItemsByValues", ["Audi A4", "Audi A5"]);

{% endhighlight %}

hideItemsByValues(values)

{:#methods:hideitemsbyvalues}

Hides the list item using its values.

Parameters Type Description
values Array Values of the listbox items to be hidden.

Example {:.example}

{% highlight js%}

        $('#list').ejListBox("hideItemsByValues", ["Audi A4", "Audi A5"]);

{% endhighlight %}

showItemByValue(values)

{:#methods:showitembyvalue}

Shows a hidden list item using its value.

Parameters Type Description
value string Value of the listbox item to be shown.

Example {:.example}

{% highlight js%}

        $('#list').ejListBox("showItemByValue", "Audi A5");

{% endhighlight %}

hideItemByValue(values)

{:#methods:hideitembyvalue}

Hide a list item using its value.

Parameters Type Description
value string Value of the listbox item to be hidden.

Example {:.example}

{% highlight js%}

        $('#list').ejListBox("hideItemByValue", "Audi A5");

{% endhighlight %}

showItemByIndex(index)

{:#methods:showitembyindex}

Shows a hidden list item using its index value.

Parameters Type Description
index number Index of the listbox item to be shown.

Example {:.example}

{% highlight js%}

        $('#list').ejListBox("showItemByIndex", 2);

{% endhighlight %}

hideItemByIndex (index)

{:#methods:hideitembyindex}

Hides a list item using its index value.

Parameters Type Description
index number Index of the listbox item to be hidden.

Example {:.example}

{% highlight js%}

        $('#list').ejListBox("hideItemByIndex", 2);

{% endhighlight %}

show

{:#methods:show}

Shows the listbox.

N> This method does not accept any arguments.

Example {:.example}

{% highlight js%}

        $('#list').ejListBox("show");

{% endhighlight %}

hide()

{:#methods:hide}

Hides the listbox.

N> This method does not accept any arguments.

Example {:.example}

{% highlight js%}

        $('#list').ejListBox("hide");

{% endhighlight %}

hideAllItems()

{:#methods:hideallitems}

Hides all the listbox items in the listbox.

N> This method does not accept any arguments.

Example {:.example}

{% highlight js%}

        $('#list').ejListBox("hideAllItems");

{% endhighlight %}

showAllItems()

{:#methods:showallitems }

Shows all the listbox items in the listbox.

N> This method does not accept any arguments.

Example {:.example}

{% highlight js%}

        $('#list').ejListBox("showAllItems");

{% endhighlight %}

Events

actionBegin

{:#events:actionbegin}

Triggers before the AJAX request begins to load data in the ListBox widget.

Name Type Description
cancel boolean if the event should be canceled; otherwise, false.
model object returns the ListBox model
type string returns the name of the event

Example {:.example}

{% highlight js%}

$("#list").ejListBox({

actionBegin: function(args) { 
    
   //do something 
}

});

{% endhighlight %}

actionSuccess

{:#events:actionsuccess}

Triggers after the data requested via AJAX is successfully loaded in the ListBox widget.

Name Type Description
cancel boolean if the event should be canceled; otherwise, false.
count number Returns number of times trying to fetch the data
model object returns the ListBox model
query object Returns the query for data retrieval
request object Returns the query for data retrieval from the Database
type string returns the name of the event
result array Returns the number of items fetched from remote data
xhr object Returns the requested data

N> It internally uses jQuery ajaxSuccess event. For details refer here.

Example {:.example}

{% highlight js%}

$("#list").ejListBox({

actionSuccess: function(args) {

    //do something

}

});

{% endhighlight %}

actionComplete

{:#events:actioncomplete}

Triggers when the AJAX requests complete. The request may get failed or succeed.

Name Type Description
cancel boolean if the event should be canceled; otherwise, false.
count number Returns number of times trying to fetch the data
model object returns the ListBox model
query object Returns the query for data retrieval
request object Returns the query for data retrieval from the Database
type string returns the name of the event
result array Returns the number of items fetched from remote data
xhr object Returns the requested data

N> It internally uses jQuery ajaxComplete event. For details refer here.

Example {:.example}

{% highlight js%}

$("#list").ejListBox({

actionComplete: function(args) {

    //do something

}

});

{% endhighlight %}

actionFailure

{:#events:actionfailure}

Triggers when the data requested from AJAX get failed.

Name Type Description
cancel boolean if the event should be canceled; otherwise, false.
error object Returns the error message
model object returns the ListBox model
query object Returns the query for data retrieval
type string returns the name of the event

N> It internally uses jQuery ajaxError event. For details refer here.

Example {:.example}

{% highlight js%}

$("#list").ejListBox({

actionFailure: function(args) {

    //do something

}

});

{% endhighlight %}

actionBeforeSuccess

{:#events:actionbeforesuccess}

Event will be triggered before the requested data via AJAX once loaded in successfully.

Event Arguments Type Description
model Object Instance of the listbox model object.
type string Name of the event.
actual Object List of actual object.
request Object Object of ListBox widget which contains DataManager arguments
cancel boolean Set this option to true to cancel the event.
result Array List of array object
xhr Object ExecuteQuery object of DataManager

Example {:.example}

{% highlight js%}

$("#list").ejListBox({

actionBeforeSuccess: function(args) {

    //do something

}

});

{% endhighlight %}

change

{:#events:change}

Triggers when the item selection is changed.

Event Arguments Type Description
model Object Instance of the listbox model object.
type string Name of the event.
item Object List item object.
data Object The Datasource of the listbox.
index number List item’s index.
cancel boolean Set this option to true to cancel the event.
isChecked boolean Boolean value based on whether the list item is checked or not.
isSelected boolean Boolean value based on whether the list item is selected or not.
isEnabled boolean Boolean value based on the list item is enabled or not.
text string List item’s text (label).
value string List item’s value.

Example {:.example}

{% highlight js%}

$("#list").ejListBox({

change: function(args) {

    //do something

}

});

{% endhighlight %}

checkChange

{:#events:checkchange}

Triggers when the list item is checked or unchecked.

Event Arguments Type Description
model Object Instance of the listbox model object.
type string Name of the event.
item Object List item object.
data Object The Datasource of the listbox.
index number List item’s index.
cancel boolean Set this option to true to cancel the event.
isChecked boolean Boolean value based on whether the list item is checked or not.
isSelected boolean Boolean value based on whether the list item is selected or not.
isEnabled boolean Boolean value based on the list item is enabled or not.
text string List item’s text (label).
value string List item’s value.

Example {:.example}

{% highlight js%}

$("#list").ejListBox({

checkChange: function(args) {

    //do something

}

});

{% endhighlight %}

create

{:#events:create}

Triggers when the ListBox widget is created successfully.

Event Arguments Type Description
model object Instance of the listbox model object.
type string Name of the event.
cancel boolean Set this option to true to cancel the event.

Example {:.example}

{% highlight js%}

$("#list").ejListBox({

create: function(args) {

    //do something

}

});

{% endhighlight %}

destroy

{:#events:destroy}

Triggers when the ListBox widget is destroyed successfully.

Event Arguments Type Description
model Object Instance of the listbox model object.
type string Name of the event.
cancel boolean Set this option to true to cancel the event.

Example {:.example}

{% highlight js%}

$("#list").ejListBox({

destroy: function(args) {

    //do something

}

});

{% endhighlight %}

focusIn

{:#events:focusin}

Triggers when focus the listbox items.

Event Arguments Type Description
model Object Instance of the listbox model object.
type string Name of the event.
cancel boolean Set this option to true to cancel the event.

Example {:.example}

{% highlight js%}

$("#list").ejListBox({

focusIn: function(args) {

    //do something

}

});

{% endhighlight %}

focusOut

{:#events:focusout}

Triggers when focus out from listbox items.

Event Arguments Type Description
model Object Instance of the listbox model object.
type string Name of the event.
cancel boolean Set this option to true to cancel the event.

Example {:.example}

{% highlight js%}

$("#list").ejListBox({

focusOut: function(args) {

    //do something

}

});

{% endhighlight %}

itemDrag

{:#events:itemdrag}

Triggers when the list item is being dragged.

Event Arguments Type Description
model Object Instance of the listbox model object.
type string Name of the event.
cancel boolean Set this option to true to cancel the event.
items Array Array of list item object
item Object List item object.
data Object The Datasource of the listbox.
index Number List item’s index.
isChecked boolean Boolean value based on whether the list item is checked or not.
isSelected boolean Boolean value based on whether the list item is selected or not.
isEnabled boolean Boolean value based on whether the list item is enabled or not.
text string List item’s text (label).
value string List item’s value.

Example {:.example}

{% highlight js%}

$("#list").ejListBox({

itemDrag: function(args) {

    //do something

}

});

{% endhighlight %}

itemDragStart

{:#events:itemdragstart}

Triggers when the list item is ready to be dragged.

Event Arguments Type Description
model Object Instance of the listbox model object.
type string Name of the event.
cancel boolean Set this option to true to cancel the event.
items Array Array of list item object
item Object List item object.
data Object The Datasource of the listbox.
index number List item’s index.
isChecked boolean Boolean value based on whether the list item is checked or not.
isSelected boolean Boolean value based on whether the list item is selected or not.
isEnabled boolean Boolean value based on whether the list item is enabled or not.
text string List item’s text (label).
value string List item’s value.

Example {:.example}

{% highlight js%}

$("#list").ejListBox({

itemDragStart: function(args) {

    //do something

}

});

{% endhighlight %}

itemDragStop

{:#events:itemdragstop}

Triggers when the list item stops dragging.

Event Arguments Type Description
model Object Instance of the listbox model object.
type string Name of the event.
cancel boolean Set this option to true to cancel the event.
items Array Array of list item object
item Object List item object.
data Object The Datasource of the listbox.
index number List item’s index.
isChecked boolean Boolean value based on whether the list item is checked or not.
isSelected boolean Boolean value based on whether the list item is selected or not.
isEnabled boolean Boolean value based on whether the list item is enabled or not.
text string List item’s text (label).
value string List item’s value.

Example {:.example}

{% highlight js%}

$("#list").ejListBox({

itemDragStop: function(args) {

    //do something

}

});

{% endhighlight %}

itemDrop

{:#events:itemdrop}

Triggers when the list item is dropped.

Event Arguments Type Description
model Object Instance of the listbox model object.
type string Name of the event.
cancel boolean Set this option to true to cancel the event.
items Array An array of list item objects which are being dropped.
item Object List item object.
data Object The Datasource of the listbox.
index number List item’s index.
isChecked boolean Boolean value based on whether the list item is checked or not.
isSelected boolean Boolean value based on whether the list item is selected or not.
isEnabled boolean Boolean value based on whether the list item is enabled or not.
text string List item’s text (label).
value string List item’s value.

Example {:.example}

{% highlight js%}

$("#list").ejListBox({

itemDrop: function(args) {

    //do something

}

});

{% endhighlight %}

select

{:#events:select}

Triggers when a list item gets selected.

Event Arguments Type Description
model Object Instance of the listbox model object.
type string Name of the event.
item Object List item object.
data Object The Datasource of the listbox.
index number List item’s index.
cancel boolean Set this option to true to cancel the event.
isChecked boolean Boolean value based on whether the list item is checked or not.
isSelected boolean Boolean value based on whether the list item is selected or not.
isEnabled boolean Boolean value based on the list item is enabled or not.
text string List item’s text (label).
value string List item’s value.

Example {:.example}

{% highlight js%}

$("#list").ejListBox({

select: function(args) {

    //do something

}

});

{% endhighlight %}

unselect

{:#events:unselect}

Triggers when a list item gets unselected.

Event Arguments Type Description
model Object Instance of the listbox model object.
type string Name of the event.
item Object List item object.
data Object The Datasource of the listbox.
index number List item’s index.
cancel boolean Set this option to true to cancel the event.
isChecked boolean Boolean value based on whether the list item is checked or not.
isSelected boolean Boolean value based on whether the list item is selected or not.
isEnabled boolean Boolean value based on the list item is enabled or not.
text string List item’s text (label).
value string List item’s value.

Example {:.example}

{% highlight js%}

$("#list").ejListBox({

unselect: function(args) {

    //do something

}

});

{% endhighlight %}