autoBind Boolean
(default: true)
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.
Setting
autoBind
tofalse
is useful when multiple widgets are bound to the same data source. Disabling automatic binding ensures that the shared data source does not make more than one request to the remote service.
Example - disable automatic binding
<select id="listBox"></select>
<script>
var dataSource = new kendo.data.DataSource({
data: [ { name: "Jane Doe" }, { name: "John Doe" }]
});
$("#listBox").kendoListBox({
dataSource: dataSource,
template: "<div>#:name#</div>",
autoBind: false
});
dataSource.read(); // "read()" will fire the "change" event of the dataSource and the widget will be bound
</script>