admin管理员组文章数量:1391937
is there any plugin that can do this?
I have a Spring MVC project, so it needs to be in html/JavaScript/java something..
Something like this: / , the second one (Multiple Select), but it doesn't have checkboxes. Also a good thing would be to have select all option on top of it, but that's optional. So in short: -Search -Multi checkbox for multiple choices
Thanks in forehand.
is there any plugin that can do this?
I have a Spring MVC project, so it needs to be in html/JavaScript/java something..
Something like this: http://harvesthq.github.io/chosen/ , the second one (Multiple Select), but it doesn't have checkboxes. Also a good thing would be to have select all option on top of it, but that's optional. So in short: -Search -Multi checkbox for multiple choices
Thanks in forehand.
Share Improve this question asked Feb 9, 2015 at 16:10 benskiiiibenskiiii 4693 gold badges11 silver badges23 bronze badges1 Answer
Reset to default 1This isn't really related to Spring directly. It's more of a HTML/JS (front-end) issue. If you like the way that the select box works on the link you provided, and it fits the scope of your project, then there's a few steps you'd want to take:
- Render the select box as normal with whichever HTML templating framework you are using with Spring (whether Themeleaf, JSP, Handlebars, or something else). Make sure there is a
multiple
attribute in theselect
tag. - Download and add the jQuery JavaScript library to this page (required for the "plugin" in the link).
- Download and add the Chosen file from your link to your page after jQuery.
- Activate the plugin as described.
Here's a brief skeleton of how I would do it (as rendered HTML, not the template; which depends on implementation):
<html>
<head>
</head>
<body>
<select class="chosen-select" multiple>
<option value="1">Option 1</option>
<option value="2">Value 2</option>
</select>
<script src="https://code.jquery./jquery-1.11.2.min.js"></script>
<script src="/path/to/resources/chosen.jquery.min.js"></script>
<script>
$(document).ready(function() {
$(".chosen-select").chosen();
});
</script>
</body>
</html>
I would definitely remend reading into jQuery and JavaScript in general on top of all of this. I hope this helps get you rolling!
本文标签: javascriptMulti select dropdown with checkbox amp search methodStack Overflow
版权声明:本文标题:javascript - Multi select dropdown with checkbox & search method - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744723389a2621829.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论