\Kendo\UI\ListBox

A PHP wrapper for Kendo UI ListBox.

Inherits from \Kendo\UI\Widget.

Usage

To use ListBox in a PHP page instantiate a new instance, configure it via the available configuration methods and output it by echo-ing the result of the render method.

Using Kendo ListBox

<?php
// Create a new instance of ListBox and specify its id
$listBox = new \Kendo\UI\ListBox('ListBox');

// Configure it
$listBox->autoBind(true)

// Output it

echo $listBox->render();
?>

Methods

addEvent

Fires before an item is added to the ListBox.The function context of the event handler (available through the this keyword) that will be set to the widget instance. For additional information check the add event documentation.

Returns

\Kendo\UI\ListBox

Parameters

$value string |\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->addEvent('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onAdd(e) {
        // handle the add event.
    }
</script>
<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->addEvent('onAdd');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->addEvent(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

autoBind

If set to false, the widget will not bind to the data source during initialization. In this case, the data binding will occur when the change event of the data source is fired. By default, the ListBox will bind to the data source that is specified in the configuration.

Returns

\Kendo\UI\ListBox

Parameters

$value boolean

Example

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->autoBind(true);
?>

change

Fires when the ListBox selection has changed.The function context of the event handler (available through the this keyword) that will be set to the widget instance. For additional information check the change event documentation.

Returns

\Kendo\UI\ListBox

Parameters

$value string |\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->change('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onChange(e) {
        // handle the change event.
    }
</script>
<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->change('onChange');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->change(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

connectWith

The id of the target ListBox to which items from the source ListBox will be transferred and vice versa. If you have to transfer items from the target ListBox over its toolbar, then you also need to set its connectWith option.

Returns

\Kendo\UI\ListBox

Parameters

$value string

Example

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->connectWith('value');
?>

dataBound

Fires when the ListBox has received data from the data source and is already rendered.The function context of the event handler (available through the this keyword) that will be set to the widget instance. For additional information check the dataBound event documentation.

Returns

\Kendo\UI\ListBox

Parameters

$value string |\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->dataBound('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onDataBound(e) {
        // handle the dataBound event.
    }
</script>
<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->dataBound('onDataBound');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->dataBound(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

dataSource

Sets the data source of the widget.

Returns

\Kendo\UI\ListBox

Parameters

$value \Kendo\Data\DataSource |array

Example - using \Kendo\Data\DataSource

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$dataSource = new \Kendo\Data\DataSource();
$listBox->dataSource($dataSource);
?>

Example - using array

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$schema = new \Kendo\Data\DataSourceSchema();
$listBox->dataSource(array('schema' => $schema));
?>

dataTextField

The field of the data item that provides the text content of the list items. Based on this field, the widget filters the data source.

Returns

\Kendo\UI\ListBox

Parameters

$value string

Example

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->dataTextField('value');
?>

dataValueField

The field of the data item that provides the value of the widget.

Returns

\Kendo\UI\ListBox

Parameters

$value string

Example

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->dataValueField('value');
?>

drag

Fires when the placeholder of the ListBox changes its position. For additional information check the drag event documentation.

Returns

\Kendo\UI\ListBox

Parameters

$value string |\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->drag('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onDrag(e) {
        // handle the drag event.
    }
</script>
<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->drag('onDrag');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->drag(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

dragend

Fires when the dragging of the item ends but before its position is changed in the DOM. For additional information check the dragend event documentation.

Returns

\Kendo\UI\ListBox

Parameters

$value string |\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->dragend('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onDragend(e) {
        // handle the dragend event.
    }
</script>
<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->dragend('onDragend');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->dragend(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

draggable

Indicates whether the ListBox items can be dragged and dropped.

Returns

\Kendo\UI\ListBox

Parameters

$value boolean |\Kendo\UI\ListBoxDraggable |array

Example - using boolean

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->draggable(true);
?>

Example - using \Kendo\UI\ListBoxDraggable

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$draggable = new \Kendo\UI\ListBoxDraggable();
$enabled = true;
$draggable->enabled($enabled);
$listBox->draggable($draggable);
?>

Example - using array

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$enabled = true;
$listBox->draggable(array('enabled' => $enabled));
?>

dragstart

Fires when the dragging of the ListBox items starts. For additional information check the dragstart event documentation.

Returns

\Kendo\UI\ListBox

Parameters

$value string |\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->dragstart('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onDragstart(e) {
        // handle the dragstart event.
    }
</script>
<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->dragstart('onDragstart');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->dragstart(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

drop

Fires when a ListBox item is dropped over one of the drop targets. For additional information check the drop event documentation.

Returns

\Kendo\UI\ListBox

Parameters

$value string |\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->drop('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onDrop(e) {
        // handle the drop event.
    }
</script>
<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->drop('onDrop');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->drop(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

dropSources

Array of id strings which determines the ListBoxes that can drag and drop their items to the current ListBox. The dropSources option describes a one way relationship. If you want a two-way connection, then set the dropSources option on both widgets.

Returns

\Kendo\UI\ListBox

Parameters

$value array

Example

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->dropSources(array());
?>

messages

Defines the localization texts for the ListBox. Used primarily for localization.

Returns

\Kendo\UI\ListBox

Parameters

$value \Kendo\UI\ListBoxMessages |array

Example - using \Kendo\UI\ListBoxMessages

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$messages = new \Kendo\UI\ListBoxMessages();
$tools = new \Kendo\UI\ListBoxMessagesTools();
$messages->tools($tools);
$listBox->messages($messages);
?>

Example - using array

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$tools = new \Kendo\UI\ListBoxMessagesTools();
$listBox->messages(array('tools' => $tools));
?>

navigatable

Indicates whether the keyboard navigation is enabled or disabled.

Returns

\Kendo\UI\ListBox

Parameters

$value boolean

Example

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->navigatable(true);
?>

remove

Fires before an item is removed from the ListBox.The function context of the event handler (available through the this keyword) that will be set to the widget instance. For additional information check the remove event documentation.

Returns

\Kendo\UI\ListBox

Parameters

$value string |\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->remove('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onRemove(e) {
        // handle the remove event.
    }
</script>
<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->remove('onRemove');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->remove(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

reorder

Fires when ListBox items are reordered. For additional information check the reorder event documentation.

Returns

\Kendo\UI\ListBox

Parameters

$value string |\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->reorder('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onReorder(e) {
        // handle the reorder event.
    }
</script>
<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->reorder('onReorder');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->reorder(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

selectable

Indicates whether the selection is single or multiple. The possible values are:

  • "single" - A single-item selection.
  • "multiple" - A multiple-item selection.

Returns

\Kendo\UI\ListBox

Parameters

$value string

Example

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->selectable('value');
?>

template

Specifies the item template of the ListBox.

Returns

\Kendo\UI\ListBox

Parameters

$value string |\Kendo\JavaScriptFunction

Example - using string

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->template('value');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$listBox->template(new \Kendo\JavaScriptFunction('function() { }'));
?>

toolbar

Defines the settings for displaying the toolbar of the ListBox. The toolbar allows you to execute a set of predefined actions.By default, the toolbar is not displayed. If the tools array is populated, then the toolbar and the corresponding tools are displayed.

Returns

\Kendo\UI\ListBox

Parameters

$value \Kendo\UI\ListBoxToolbar |array

Example - using \Kendo\UI\ListBoxToolbar

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$toolbar = new \Kendo\UI\ListBoxToolbar();
$position = 'value';
$toolbar->position($position);
$listBox->toolbar($toolbar);
?>

Example - using array

<?php
$listBox = new \Kendo\UI\ListBox('ListBox');
$position = 'value';
$listBox->toolbar(array('position' => $position));
?>
Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve the information

close
Dummy