doc

博客:

基于Metronic的Bootstrap开发框架经验总结(3)--下拉列表Select2插件的使用

               <div class="span4 channelSearch">
<div class="input-control select size3">
@Html.DropDownList("ChannelIds",
Model.Channels.Select(c => new SelectListItem
{
Text = c
}),
new { style = "width:100%;height:22px", multiple = "multiple" })
</div>
</div>

  

$("#ChannelIds").select2({
placeholder: 'This is my placeholder' ,
allowClear: true
}); $("#ChannelIds").val(campaignIds.split(",")).trigger('change');

添加全选:

          $('.select-all').on('select2:opening', function (e) {
var $this = $(this);
if ($this.children(".optionAll").length==0) {
$this.prepend("<option class='optionAll' value='-100'>---全选----</option>");
}
}); $('.select-all').on('select2:select', function (e) {
var $this = $(this);
if (e.params.data.id == "-100") {
EntityOperation.selectAllSelect2($this);
}
});

  

  

Seletct2的更多相关文章

随机推荐

  1. 【Linux学习四】正则表达式

    环境 虚拟机:VMware 10 Linux版本:CentOS-6.5-x86_64 客户端:Xshell4 FTP:Xftp4 一.grep:显示匹配行v:反显示e:使用扩展正则表达式E:不使用正则 ...

  2. mac电脑使用,开发环境配置指南

    mac电脑使用,开发环境配置指南 前端工具链,mac下都很好用 用brew来装软件 用brew cask来装应用 Introduction · macOS Setup Guidehttp://sour ...

  3. linux centos 如何设置swap大小?

    linux centos 如何设置swap大小? swap的值都是安装系统的时候设置好的,一般设置为内存的两倍大小.使用过程中发现swap值过小只能添加.用free -m 命令查看当前swap大小 使 ...

  4. Codeforces 579A. Raising Bacteria

    You are a lover of bacteria. You want to raise some bacteria in a box. Initially, the box is empty. ...

  5. 学习Linux shell脚本中连接字符串的方法

    这篇文章主要介绍了Linux shell脚本中连接字符串的方法,如果想要在变量后面添加一个字符,可以用一下方法: 代码如下: $value1=home $value2=${value1}"= ...

  6. The Little Prince-12/16

    The Little Prince-12/16 今天四六级考完了呢,布吉岛大家考的怎么样,会有好多好多奇葩翻译吧,哈哈哈! 突然放出一条16年的笑笑汪~~~今年的也应该会很快出炉了,段子手们准备好!! ...

  7. 怎样从外网访问内网SQLServer数据库?

    本地安装了一个SQLServer数据库,只能在局域网内访问到,怎样从外网也能访问到本地的SQLServer数据库呢?本文将介绍具体的实现步骤. 1. 准备工作 1.1 安装并启动SQLServer数据 ...

  8. xml文件中[Invalid byte 1 of 1-byte UTF-8 sequence.]的解决方案

    问题描述: 导入项目包后发生xml文件出现错误信息:[Invalid byte 1 of 1-byte UTF-8 sequence.],如下截图所示: 解决方案: 将xml文件全部内容剪切到Note ...

  9. Spring Boot(十五):spring boot+jpa+thymeleaf增删改查示例

    Spring Boot(十五):spring boot+jpa+thymeleaf增删改查示例 一.快速上手 1,配置文件 (1)pom包配置 pom包里面添加jpa和thymeleaf的相关包引用 ...

  10. Zookeeper .Net客户端代码

    本来此客户端可以通过NuGet获取,如果会使用NuGet, 则可以使用命令Install-Package ZooKeeperNet(需要最新版本的NuGet) 如果不会,就去 NuGet官网了解htt ...