如何在一个轨道collasped下拉列表simple_form [英] How to have a collasped drop down list in rails simple_form

查看:227
本文介绍了如何在一个轨道collasped下拉列表simple_form的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序,有两种型号:询价和标准。他们的关系是多到多。在创建询价屏幕上,code下面显示可用列表中进行选择在下拉列表中:

In my app, there are two models: rfq and standard. Their relationship is many-to-many. In rfq creating screen, the code below displays a list of available for selection in drop down list:

<%= simple_form_for @rfq do |f| %>    
<%= f.association :standards, :collection => Standard.active_std.all(:order => 'name'), :label_method => :name, :value_method => :id %> 
<% end %>

的问题是,该列表是不折叠,这意味着有一个多线箱中显示的多个标准。我怎样才能盒子减少只有一条线?

The problem is that the list is not collapsed, which means there are multiple standards displayed in a multi-line boxes. How can I reduce the box to one line only?

感谢。

更新:这里是多行列表框的屏幕截图:

UPDATED: here is the screen shot of multiple line list box:

推荐答案

这是创造一个多选,因为一个询价可以有很多标准,所以它可以让你按住Ctrl键单击选择很多标准。

It's creating a multi-select because one rfq can have many standards, so it allows you to ctrl-click to select many standards.

您可以尝试添加:input_html =&GT; {:大小=&GT;'1'} ,但我不知道这种意志preserve滚动条。它绝对不会降下来了。

You could try adding :input_html => { :size =>'1' } but I'm not sure that will preserve the scrollbar. It definitely won't drop down.

下面是别人谁想做同样的事情:<一href=\"http://stackoverflow.com/questions/2463055/html-muliple-select-should-look-like-html-select\">HTML muliple选择应该像HTML选择。答案之一是指检查下拉列表 jQuery中实现,但是这将需要一些工作与SimpleForm整合

Here's someone else who wanted to do the same thing: HTML muliple select should look like HTML select. One of the answers refers to a Dropdown Check List implemented in jQuery, but that would take some work to integrate with SimpleForm.

SimpleForm有一个非常有用的谷歌集团 - 你可能会得到更多的想法有:

SimpleForm has a very helpful Google Group--you might get more ideas there:

http://groups.google.com/group/plataformatec-simpleform

这篇关于如何在一个轨道collasped下拉列表simple_form的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆