Skip to content

Commit

Permalink
Merge pull request #167 from ssi-anik/master
Browse files Browse the repository at this point in the history
Selected option order issue resolved
  • Loading branch information
yanickrochon committed Jan 30, 2016
2 parents d918211 + 604e475 commit 71eda5f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion README.textile → README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
h2. jQuery UI Multiselect
## jQuery UI Multiselect

This repository is no longer actively maintained by the author. However, pull requests are always welcome. If there's someone interested in officially maintaining the plugin, please let me know.

In case you are looking for an AJAX version, please also consider "Yanick Rochon's":http://github.com/michael/multiselect/tree/next version, or also check the official "version 2.0":https://github.com/yanickrochon/jquery.uix.multiselect currently in development.

To get the order of the selected items as selected, you can do like
```javascript
var form = $("form#my_form");
$(form).on('submit', function(){
$("ul.selected li").each(function(){
var selected_value = $(this).attr('data-selected-value');
if(selected_value){
$(form).append("<input type='hidden' value='" + selected_value + "' name='selected_items_values_in_order[]' />");
}
});
});
```
2 changes: 1 addition & 1 deletion js/ui.multiselect.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ $.widget("ui.multiselect", {
},
_getOptionNode: function(option) {
option = $(option);
var node = $('<li class="ui-state-default ui-element" title="'+option.text()+'"><span class="ui-icon"/>'+option.text()+'<a href="#" class="action"><span class="ui-corner-all ui-icon"/></a></li>').hide();
var node = $('<li class="ui-state-default ui-element" title="'+option.text()+'" data-selected-value="' + option.val() + '"><span class="ui-icon"/>'+option.text()+'<a href="#" class="action"><span class="ui-corner-all ui-icon"/></a></li>').hide();
node.data('optionLink', option);
return node;
},
Expand Down

0 comments on commit 71eda5f

Please sign in to comment.