Here is a little bit of a modified one from yours, got it working as well. It uses a selected property on each item in the array that's an observable to do two way communication. If you want a property that's just a list of the selected items, you could always create a dependent observable, or just a method to filter.
http://jsfiddle.net/QCmJt/32/
Created a custom binding:
ko.bindingHandlers.selectableItem = {
init: function(element, valueAccessor, allBindingsAccessor) {
var selectable = $(element).parent();
selectable.bind('selectableselected', function(event, ui) {
if(ui.selected === element) {
var value = valueAccessor();
value(true);
}
});
selectable.bind('selectableunselected', function(event, ui) {
if(ui.unselected === element) {
var value = valueAccessor();
value(false);
}
});
},
update: function(element, valueAccessor, allBindingsAccessor, viewModel) {
var el = $(element);
if(valueAccessor()()) {
el.addClass('ui-selected');
} else {
el.removeClass('ui-selected');
}
}
};
It's not hardened for more than very simple two way bindings, but should be easy enough to build on.