Rails 3 中的组合框 [英] Combo box in Rails 3

查看:32
本文介绍了Rails 3 中的组合框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 Rails 3 中构建一个组合框.它混合了输入文本字段和下拉菜单.

I would like to build a combo box in Rails 3. It's a mix of input textfield and a dropdown menu.

最好的方法是什么?

推荐答案

html 中没有组合框的标准实现.

There is no standard implementation of a combobox in html.

或者你提供一个简单的下拉框,并添加一个 + 按钮,允许动态地将新项目添加到列表 (javascript).如果项目数量不经常变化,这还不错.

Either you provide a simple drop-down box, and add a + button allowing to dynamically add new items to the list (javascript). This is not bad if the number of items does not change too often.

常用的替代方法是使用标准文本字段,并使用自动完成器来建议可能的选项,但允许用户偏离.

An often used alternative is to use a standard text-field, and use an autocompleter to suggest the possible options, but allow to user to deviate.

或者你在谷歌上搜索大量虚假组合框(例如可编辑下拉框)实现的例子使用javascript.

Or you google for the numerous examples of fake combobox (e.g. editable drop-down-box) implementations using javascript.

这篇关于Rails 3 中的组合框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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