dataItems
Returns an array of the data items that are bound to the ListBox widget. This method provides access to the underlying data objects, which can be useful for programmatic manipulation or inspection of the widget's data. The returned array contains observable objects that reflect the current state of the data source. Unlike the items()
method which returns DOM elements, dataItems()
returns the actual data objects.
Returns
kendo.data.ObservableArray
An array of data items to which the widget is bound.
Example
<select id="listBox"></select>
<script>
var dataSource = new kendo.data.DataSource({
data: [{ name: "Jane Doe" }, { name: "John Doe" }]
});
var listBox = $("#listBox").kendoListBox({
dataSource: dataSource,
template: "<div>#:name#</div>"
}).data("kendoListBox");
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(listBox.dataItems()) //will output the bound array
</script>
In this article