added support to sortable callbacks, removed trailing witespaces, removed unused css class 'actions'
hi! I added some changes to your code because i needed a callback for the sortable list. I use your multiselect as a layer selector for OpenLayers (unfortunately i don't have an online public demo). When i sort the list i want the layers on the map to sort too.
So i use this code to create the multiselect:
$(".multiselect").multiselect({
sortable: 'left',
sortableUpdate:
function(event, ui, sortable) {
var layer_list = sortable.sortable("toArray");
var layer_id = ui.item.attr("id");
var layer = map.getLayersBy("id", layer_id)[0];
if (!(layer.isBaseLayer || layer_id.search("OSM") != -1)) {
var layer_pos = layer_list.length - 1 - layer_list.indexOf(layer_id);
if (layer_pos != 0) {
console.log("moving " + layer_id + " to " + layer_pos);
map.setLayerIndex(layer, layer_pos);
return;
}
}
sortable.sortable('cancel');
},
selected:
function(event, ui) {
map.getLayersByName($(ui.option).val())[0].setVisibility(true);
},
deselected:
function(event, ui) {
map.getLayersByName($(ui.option).val())[0].setVisibility(false);
}
});
I removed some trailing whitespaces, and an unused css class that was messing everything up because it is defined in the twitter bootstrap css (which i'm using for the whole webpage style).
The 'actions' class added in js messes things up with Twitter Bootstrap. Looks like it should be 'action' according to the css.
Yes, it's what my patch is about. You can use my fork in the meanwhile