bootstrap-duallistbox 多对多选择控件

版权声明:Myfour的个人笔记 转载请声明来源 https://blog.csdn.net/sinat_36663351/article/details/83620657
  1. 其是bootstrap下的控件,所以要引入bootstrap相关css与js以及jquery,并引入自己的
<link rel="stylesheet" href="{% static 'yd/bootstrap-duallistbox.min.css' %}">
<script src="{% static 'yd/jquery.bootstrap-duallistbox.min.js' %}"></script>
  1. 给相应的select标签一个对应的类名,然后用js调用控件,并设置参数
<script type="text/javascript">
    $(function () {
        $('.m2mselect').bootstrapDualListbox({
            nonSelectedListLabel: '未选项',
            selectedListLabel: '已选项',
            filterTextClear: '全部',
            filterPlaceHolder: '过滤条件',
            preserveSelectionOnMove: 'moved',
            moveOnSelect: false,
            moveAllLabel: '添加全部',
            moveSelectedLabel: '添加选中',
            removeAllLabel: '移除全部',
            removeSelectedLabel: '移除选中',
            infoText: '选中/未选中共 {0} 项',
            infoTextFiltered: '从 {1} 项 筛选 {0} 项',
            infoTextEmpty: '空',
        });
    });

猜你喜欢

转载自blog.csdn.net/sinat_36663351/article/details/83620657