双面多重选择,适用于Rails 3 [英] two sided multi select that works with Rails 3
问题描述
我需要Rails(3.2.8)中的双面多选框,就像这样:
http://www.stevefenton.co.uk/Content/Jquery-Two-Sided-Multi-Selector/ < a>
但是,我无法使用Rails来处理这个问题,而且记录如此糟糕,我不得不放弃这个问题。 (它显示,但按钮不起作用,即使在一个新的Rails应用程序)
有谁知道类似的jquery或gem解决方案,可以使用rails吗?
非常感谢!
a href =http://quasipartikel.at/multiselect/ =nofollow> http://quasipartikel.at/multiselect/
或者这是另一个: http://loudev.com/
<然后在Rails视图中创建类似下面的选项(多个部分对于任何一个插件都很重要):
在您的视图中还有以下JavaScript代码:
< script>
$(document).ready(function(){
$(。multiselect)。multiselect(); //如果你正在使用quasipartikel
$('。multiselect ').multiSelect(); //如果你使用的是loudev.com,那么
});
< / script>
I need a two sided multi select box in Rails (3.2.8), just like here:
http://www.stevefenton.co.uk/Content/Jquery-Two-Sided-Multi-Selector/
However, I can't get this to work with Rails and it is so poorly documented I have to give up on that one. (It shows but the buttons don't work, even on a fresh Rails app)
Does anyone know of a similar jquery or gem solution that DOES work with rails??
Many thanks!
You could try this one: http://quasipartikel.at/multiselect/
Or this is another: http://loudev.com/
And then create your select something like the following in your Rails view (the "multiple" part is important for either plugin):
<%= f.select(:country, "country_id", Country.all.collect {|c| [ c.name, c.id ] }, {:include_blank => false}, {:class => "multiselect", :multiple => "multiple"}) %>
And also have the following JavaScript in your view:
<script>
$(document).ready(function (){
$(".multiselect").multiselect(); // If you're using the quasipartikel one
$('.multiselect').multiSelect(); // If you're using the loudev.com one
});
</script>
这篇关于双面多重选择,适用于Rails 3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!