使用 HTML + JavaScript 实现多列组合框

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4221439/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 11:26:31  来源:igfitidea点击:

Implement multi column combo box using HTML + JavaScript

javascripthtml

提问by Cheok Yan Cheng

I am looking a multi columns combo box by using HTML + JavaScript only. Is there any example or library available? As I came across some solution, they are in ASP.NET, but not pure HTML + JavaScript.

我正在寻找一个多列组合框,只使用 HTML + JavaScript。有没有可用的示例或库?当我遇到一些解决方案时,它们在 ASP.NET 中,但不是纯 HTML + JavaScript。

Here is an example but it is implemented using Java Swing.

这是一个示例,但它是使用 Java Swing 实现的。

alt text

替代文字

采纳答案by Surreal Dreams

If jQuery is an option, here's a plugin that looks like it can deliver this:

如果 jQuery 是一个选项,这里有一个插件,它看起来可以提供这个:

Jquery Multi Column Selectbox

Jquery 多列选择框

回答by SuperDuck

Flexboxis probably the best one I have ever used with jQuery, with paging and JSON support :

Flexbox可能是我用过的最好的 jQuery 了,支持分页和 JSON:

http://flexbox.codeplex.com/

http://flexbox.codeplex.com/

It's a real combo box, as it displays the results by typing. It can be easily restyled through the CSS.

这是一个真正的组合框,因为它通过键入显示结果。它可以很容易地通过 CSS 重新设计。

Eg. to modify the rows :

例如。修改行:

.ffb .content .row {
    border-bottom: 1px solid #828790;
    clear: both;
    color: #000000;
    height: 20px;
}

border-bottommay be removed to get rid of lines between rows.

border-bottom可以删除以摆脱行之间的行。

回答by Juan Mendes

http://dev.sencha.com/deploy/dev/examples/form/combos.htmlShows ExtJS's combo box. Their combo box can be customized with template to be used for rendering each entry. All you'd need to do is to specify a template that contains a few spans with a set width.

http://dev.sencha.com/deploy/dev/examples/form/combos.html显示 ExtJS 的组合框。他们的组合框可以使用模板进行自定义,以用于呈现每个条目。您需要做的就是指定一个模板,其中包含几个具有设置宽度的跨度。

If you're willing to use ExtJS (not free), write it in here, and I'll show you an example

如果你愿意使用 ExtJS(不是免费的),把它写在这里,我会给你一个例子