• bootstrap-multiselect 使用说明


     

     
    <link rel="stylesheet" href="themes/plugins/bootstrap-multiselect/css/ace.css"  /> 
    <link rel="stylesheet" href="themes/plugins/bootstrap-multiselect/css/font-awesome.css" />
    <link rel="stylesheet" href="themes/plugins/bootstrap-multiselect/css/bootstrap-multiselect.css" />
    
    <html>
    <select id="subject" name="subject" class="multiselect" multiple="" style="height:28px;160px;" ><{$option_subject}></select>
    <input id='subject_selected' name='subject_selected' type="hidden"  value="" /> 
    
    <script type="text/javascript">
    //取值   $('#consult_subject').val()
    //post取值 用 consult_subject_selected
    if($('#consult_subject').val()!=null){
        $('#consult_subject_selected').val($('#consult_subject').val());
    }
    //多选 赋值

      $("#subject").val("");
      $("#subject").multiselect("refresh");

    var multiselect_item = row.subject;    //aa="1,2,3"
    var multiselect_arr= new Array();
    var multiselect_arr =multiselect_item.split(",");      
    $('#subject').multiselect('select', multiselect_arr);  //这里直接传aa是不行的
    
    </script>
    
    //下面是 必须有的
    <script type="text/javascript" src="themes/plugins/bootstrap-multiselect/js/bootstrap-multiselect.js"></script>
    <script type="text/javascript">
    jQuery(function($){
        ////////////////// btn-white btn-primary
        $('.multiselect').multiselect({
            enableFiltering: true,
            buttonClass: 'btn btn-white btn-primary',
            templates: {
                button: '<button type="button" class="multiselect dropdown-toggle" data-toggle="dropdown"></button>',
                ul: '<ul class="multiselect-container dropdown-menu"></ul>',
                filter: '<li class="multiselect-item filter"><div class="input-group"><span class="input-group-addon"><i class="fa fa-search"></i></span><input class="form-control multiselect-search" type="text"></div></li>',
                filterClearBtn: '<span class="input-group-btn"><button class="btn btn-default btn-white btn-grey multiselect-clear-filter" type="button"><i class="fa fa-times-circle red2"></i></button></span>',
                li: '<li><a href="javascript:void(0);"><label></label></a></li>',
                divider: '<li class="multiselect-item divider"></li>',
                liGroup: '<li class="multiselect-item group"><label class="multiselect-group"></label></li>'
            }
        });
        ///////////////////
    });
    </script>
  • 相关阅读:
    DbUtil组件及C3P0数据库连接池组件的使用
    servlet过滤器
    JDBC实现往MySQL插入百万级数据
    学会怎样使用Jsp 内置标签、jstl标签库及自定义标签
    一种c#深拷贝方式完胜java深拷贝(实现上的对比)
    JSP三个指令及9个内置对象
    java web工程的错误页面的简单配置
    理解java Web项目中的路径问题
    web应用程序servlet的映射名称的规则及请求过程
    tomcat上servlet程序的配置与处理servlet请求过程
  • 原文地址:https://www.cnblogs.com/hailexuexi/p/12889424.html
Copyright © 2020-2023  润新知