select2插件的使用
<select id="prd_tech_for_load" class="selectable" style="width:180px;">
</select>
不需要分页时,直接在select内添加option列表
如果要分页的话
$(function () {
$("#prd_tech_for_load").select2();
var sel_tech = $("#prd_tech_for_load").select2({
placeholder: abp.localization.values['ICT'].SelTechReq,
ajax: {
url: '../PDE/GetProductList',
dataType: 'json',
delay: 250,
data: function (params) {
return {
queryText: params.term // search term
};
},
processResults: function (data, params) {
params.page = params.page || 1;
return {
results: data.result.data,
pagination: {
more: 1 < data.totalPages
}
};
},
cache: true
},
//disabled: true,
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
minimumInputLength: 0,
templateResult: function (item) { // 显示查询结果
var display = '';
if (item.technology != null) display += item.technology;
//if (item.customerName != null) display += '(' + item.customerName + ')';
return display;
},
templateSelection: function (item) { // 显示选中的对象
var display = '';
if (item.technology != null) display += item.technology;
if (item.customerName != null) display += '(' + item.customerName + ')';
return display || item.text;
}
}); sel_tech.on("select2:select", function (e) {
defaultVue.ProductID = e.params.data.productId;
});
});
这里要注意的一个问题是,后台返回的数据列表必须含有id这个字段,不然会出现问题,一直不能选中数据。
这个不知道的人,被坑死了!
select2插件的使用的更多相关文章
- select2插件
引入select2插件<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min. ...
- 基于Metronic的Bootstrap开发框架经验总结(3)--下拉列表Select2插件的使用
在上篇<基于Metronic的Bootstrap开发框架经验总结(2)--列表分页处理和插件JSTree的使用>介绍了数据的分页处理,使用了Bootstrap Paginator插件,另外 ...
- Metronic_下拉列表Select2插件的使用
这个插件是基于Select的扩展插件,能够提供更加丰富的功能和用户体验,它的github官网地址为:https://select2.github.io/,具体的使用案例,可以参考地址:https:// ...
- jQuery的下拉选select2插件用法
1转自:https://www.jb51.net/article/95561.htm 用了这么久的Select2插件,也该写篇文章总结总结.当初感觉Select2不是特别好用,但又找不到比它更好的下拉 ...
- select2插件用法
1.修改默认查询方法,使其可以根据value查询 this.element.select2({ allowClear: true, matcher: function (term, text, ele ...
- Select2插件的隐藏、设置宽度
<select id="selPrinvice" class="Select2 select2-hidden-accessible" style=&quo ...
- 01:jQuery的下拉选select2插件用法
1.1 select2插件基本使用 1.下载select2插件 1. 下载地址:https://github.com/select2/select2 2.官网地址:https://select2.or ...
- select2插件使用小记2 - 多选联动 - 笔记
这是select2插件使用的第二篇,可参考第一篇 select2插件使用小记.上一篇主要是关于基本的使用,这篇主要是关于多选,及联动的.侧重点不同. 效果图如下: 遵从W3C标准:结构.样式.行为.以 ...
- 在select2插件中append下拉选,点击没反应的解决
今天前端大佬帮我解决了一个棘手的问题:克隆了已有系统的网页,尝试把复制下来的html改造成jsp.基本功能正常,然而点击新增按钮,出来的行无法点击下拉选,控制台也没报错. 项目用的是jeesite2. ...
- select2 插件
官网:http://select2.github.io/ Select2是基于jQuery的一个插件,没有引用jQuery,是没有效果的 1.在实现给select2添加placeholder效果的 ...
随机推荐
- 使用 google gson 转换Timestamp或Date类型为JSON字符串.
http://blog.csdn.net/z69183787/article/details/13016289 创建类型适配类: import java.lang.reflect.Type; impo ...
- HttpLuaModule 获取Get和Post参数
Get方式: local id = tostring(ngx.var.arg_id) local type = tostring(ngx.var.arg_type) Post方式: ngx.req.r ...
- 【BZOJ】1513: [POI2006]Tet-Tetris 3D
题意 给\(n(1 \le n \le 20000)\)个立方体\((x, y, z)\),依次落下.求所有立方体落下完了以后最高的高度. 分析 平面求最大值,平面更新最大值. 题解 二维线段树走起, ...
- GO语言练习:第一个Go语言工程--排序
1.代码 2.编译 3.运行 1.代码框架 /home/fengbo/sorter $ tree . ├── bin ├── pkg ├── readme.txt └── src ├── algori ...
- 通过串口设备vid,pid自动获得该设备所对应的串口号
用C#做串口通讯很方便,因为dotfx2.0已经集成了Serial Port控件,此控件使用上比MSComm控件更简单,当然它也有一个小bug (RecievedBytesThreshold设置有时候 ...
- IIS7 + mysql + php + wordPress 在win7下部署
最近在玩WordPress.wiki等开源平台的站点部署.通过一下实践和资料学习,为了以后少走弯路,觉得有必要把这个过程记录下来. 用到的东西: IIS服务: mysql; php; wordpres ...
- python中的进程、线程(threading、multiprocessing、Queue、subprocess)
Python中的进程与线程 学习知识,我们不但要知其然,还是知其所以然.你做到了你就比别人NB. 我们先了解一下什么是进程和线程. 进程与线程的历史 我们都知道计算机是由硬件和软件组成的.硬件中的CP ...
- Why does this json4s code work in the scala repl but fail to compile?
I'm converting a json-like string into json, and the following code works in the scala repl import o ...
- app设计需注意的
手机上同步photoshop设计稿: ps play应用 设计: 资源: 1.音乐上传问题 音乐控制在2M以内,推荐使用[格式工厂]进行压缩. 2.视频上传问题 为了保证在线的播放效果,上传的视频大小 ...
- 新一波makefile
# CROSS_COMPILE = arm-linux-CC = $(CROSS_COMPILE)gccINC=-I../ -I.LIB=-lpthread -lcryptoCC_FLAG= -std ...