Currently, the Kendo ListBox has methods to return -- the DOM Elements using items(); the Selected DOM Elements using select(); ALL of the Data Items using .dataItems() and a SINGLE dataItem using dataItem(selector).
An additional method that would be extremely useful for this control, would be to return the SELECTED DATA ITEMS perhaps using a method selectedDataItems().
Here is a JavaScript function that can be used as a template for providing the functionality (of course, it needs additional error checking):
function getSelectedItems(lstName) {
var selectedItems = [];
//var lstItems = $(lstName).data("kendoListBox").items();
var lstItems = $(lstName).data("kendoListBox").select();
$(lstItems).each(function (index) {
var selected = $(this).hasClass("k-state-selected");
if (selected) {
var id = "#" + $(this).attr("id");
var dataItem = $(lstName).data("kendoListBox").dataItem(id);
selectedItems.push(dataItem);
}
});
return selectedItems;
}
In a control such as a ListBox that inherently requires the functionality of "selection" -- then your user community would definitely need a way to not only return the selected DOM elements but also return the selected dataItems.
Hopefully, we see this functionality added to the Kendo ListBox very soon.