最近在使用英文检索select2(V3.5版本)时发现一个问题:多音字,重庆在有的拼音库里面被翻译成了重(zhong)庆,无奈只有同时支持中文检索,select2如何支持中英文检索呢,下面直接如题,上代码~~~
往select2里面通过jquery的append添加数据,但是没有默认选择第一项,通过设置select默认选择项的方法设置该选择框的默认选择项,虽然通过$("#select").val()的方法知道该选择框有了默认选择项,但是select2显示的是placeholder的内容,如何解决?
// 加载数据 $("#e11").select2({ placeholder: "Select report type", allowClear: true, data: [{id: 0, text: 'story'},{id: 1, text: 'bug'},{id: 2, text: 'task'}] }); // 加载数组 支持多选 $("#e11_2").select2({ createSearchChoice:function(term, data) { if ($(data).filter(function() { return this.text.localeCompare(term)===0; }).length===0) {return {id:term, text:term};} }, multiple: true, data: [{id: 0, text: 'story'},{id: 1, text: 'bug'},{id: 2, text: 'task'}] }); function log(e) { var e=$(""+e+""); $("#events_11").append(e); e.animate({opacity:1}, 10000, 'linear', function() { e.animate({opacity:0}, 2000, 'linear', function() {e.remove(); }); }); } // 对元素 进行事件注册 $("#e11") .on("change", function(e) { log("change "+JSON.stringify({val:e.val, added:e.added, removed:e.removed})); }) // 改变事件 .on("select2-opening", function() { log("opening"); }) // select2 打开中事件 .on("select2-open", function() { log("open"); }) // select2 打开事件 .on("select2-close", function() { log("close"); }) // select2 关闭事件 .on("select2-highlight", function(e) { log ("highlighted val="+ e.val+" choice="+ JSON.stringify(e.choice));}) // 高亮 .on("select2-selecting", function(e) { log ("selecting val="+ e.val+" choice="+ JSON.stringify(e.choice));}) // 选中事件 .on("select2-removing", function(e) { log ("removing val="+ e.val+" choice="+ JSON.stringify(e.choice));}) // 移除中事件 .on("select2-removed", function(e) { log ("removed val="+ e.val+" choice="+ JSON.stringify(e.choice));}) // 移除完毕事件 .on("select2-loaded", function(e) { log ("loaded (data property omitted for brevity)");}) // 加载中事件 .on("select2-focus", function(e) { log ("focus");}) // 获得焦点事件 .on("select2-blur", function(e) { log ("blur");}); // 失去焦点事件 $("#e11").click(function() { $("#e11").val(["AK","CO"]).trigger("change"); }); 官网文档地址是:http://select2.github.io/select2/#documentation。说再多也没用,最后我们来个实例来证明一下ajax请求远程数据,以截图为准:
你必须在其它地方能获取到这个select标签,所以要为其设置id、class或者是name以便能得到这个标签。multiple属性是是否可以多选。option是下拉框中多选的内容。例如在angluar中,使用ng-repeat循环出来值xxx,然后放在option中供select使用。
在使用select2的搜索功能时,搜索结果会显示搜索关键词,这不是我想要的,我只想让用户选择列表框实际存在的数据,再一次还是select2 3.5版本(点击打开链接)的官方文档,官方解释:
用了这么久的Select2插件,也该写篇文章总结总结。当初感觉Select2不是特别好用,但又找不到比它更好的下拉框插件。
laravel-admin后台框架的select选择框的默认选中,结合select2的js插件;
在上篇《基于Metronic的Bootstrap开发框架经验总结(2)--列表分页处理和插件JSTree的使用》介绍了数据的分页处理,使用了Bootstrap Paginator插件,另外对树形列表,采用了JSTree插件,本篇继续介绍在编辑页面中常用到的控件Select2,这个控件可以更加丰富传统的Select下拉列表控件,提供更多的功能和更好的用户体验。 1、Select2控件介绍 这个插件是基于Select的扩展插件,能够提供更加丰富的功能和用户体验,它的github官网地址为:https://sel
有时在使用select2插件时会遇到这种需求:一次性选择一些数据,然后根据这些数据自动选择相关项,我也遇到了这种需求并实现,这里简单讲讲我的做法:
今天在开发公司一个功能时,公司开发环境用的是laravel-admin,因为需要用上select联动,所以根据文档说明进行开发,并成功的使用上了,代码我就不重复,大家可以去参考laravel-admin官网的说明。
本文实例讲述了laravel框架select2多选插件初始化默认选中项操作。分享给大家供大家参考,具体如下:
A:上一期,我们回答了JS/JQuery如何获取下拉框选中的文本和值。那么今天的问题,我们可以继续聊聊下拉框了。
1、使用插件,首先要引入别人的插件了,你可以选择离线(无网络)或者在线引用的(如果有网络)。
LOT.UI分解系列汇总:http://www.cnblogs.com/dunitian/p/4822808.html#lotui LoT.UI开源地址如下:https://github.com/dunitian/LoTCodeBase/tree/master/LoTUI 这个必须说下,本来是用Bootstrap-Select做的,很漂亮,正好后台也是Bootstrap。后来发现不能满足需求。标签有则选,没则添加 而Bootstrap-Select的文本框是不可以手动输入的==》so,用了Select2,这
最近在项目啊开发中需要从下拉列表中获取游戏ID,而后台游戏数据有将近25万条,这种情况下是不可能实现一次性加载的,只能分批异步加载。找了很多插件,都没有合适的,也想过自己做一个插件,无奈时间有限,任务比较紧,只能借助第三方插件,缩短项目时间。最终找到了select2这个插件。
ui-select指令 ui-select的指令和事件 属性 选项 描述 值 默认值 multiple 多选,直接加上multiple属性 close-on-select 在多选情况下,选中一项,就关闭下拉项 boolean true append-to-body 在多选情况下,选中项追加显示 boolean false ng-disabled 控件被禁用 boolean true ng-model 控件绑定对象 String,number,array undefined search-enabled
今天给大家推荐的这个项目—— MCMS是因为使用手册、部署手册非常完善,项目也有教程视频,对小白非常贴心,接私活可以直接拿去二开非常舒服。
由于没有使用过require,在微擎人人商城中遇到了一个需要自动复制内容的功能。头疼了一番。
为了方便资源管理和提升工作效率,常用的js和css文件的加载应该放在一个统一文件里面完成,也方便后续的资源维护。所以我用js写了以下方法,存放在“sourceController.js”文件内。 /** * Created by MingChen on 2016/11/3. */ function sourceController() { this.root = ""; this.callfunc = null; // 回调函数 this.css = []; thi
按照select2官网配置完后,搜索框弹出后无法输入内容,究竟怎么回事,于是在其他页面尝试了select2,发现可以啊,为什么在这个地方不可以,终于找到了造成这个问题的不同之处:select2在模态对话框中会失效。找到了问题所在,但不知道如何解决:百度或者google,最终找到了解决方案:
在写thymeleaf页面的时候,我为了偷懒,不想为每个select下拉列表框都写一个接口,于是这个懒人jar诞生了。该jar的核心功能是直接通过thymeleaf页面的自定义标签的属性,直接运行sql并初始化select数据。
简单的小功能,但是用起来还是蛮爽的。分享出来让更多的人有更快的开发效率,开开心心快乐编程。 如果你还没有使用过composer,你可就out了,看我的教程分享,composer简直就是必备神奇有木有。都说到这个点上了,我们赶紧使用composer进行安装吧。 不急,先来看看效果图是啥样的,不然都没心情没欲望看下去。
遇到一个需求: 在前端使用 Select2 设计一个联想输入 dropdown, 通过 Ajax 动态抓取数据
本文使用博客园Markdown编辑器进行编辑 1.问题呈现 项目中使用了jQuery UI的Dialog控件,一般用来处理需要提示用户输入或操作的简单页面。逻辑是修改一个广告的图片和标题。 效果截图
程序汪推荐这个项目是因为使用手册部署手册非常完善,项目也有开发教程视频对小白非常贴心,接私活可以直接拿去二开非常舒服(程序汪就这么干过,后面分享具体心得)
昨天又有一个同学反馈,跟着视频写代码,一样的代码,但是为啥我这的autocomplete light就不生效。第一个同学反馈我以为是autocomplete light的版本问题,再次有人反馈,那可能是哪不太对劲。
部分人可能会因为镜像的问题失败,解决方法https://mp.weixin.qq.com/s/XvKb5FjAGM6gYsxTw3tcWw
https://github.com/angular-ui/ui-select/wiki
select2 没有 allowClear 不生效 添加: placeholder: "请选择", placeholderOption: "first", $("[name=deptNo]").htm
这个功能很小,只是一个函数的问题,之所以写这篇文章是因为当时遇到这个问题在百度上搜索半天无果,希望能帮到遇到该问题的朋友。
做一个好看的页面真的是一件困难的事情,所以还是遵循复制后修改的原则,首先是借鉴httpbin页面的方式进行块状展开。
<1> jQuery由美国人John Resig创建,至今已吸引了来自世界各地的众多 javascript高手加入其team。
在先前的文章里我们涵盖了React基本原理和如何构建更加复杂的交互组件。此篇文章我们将会继续探索React组件的特性,特别是生命周期。
下面介绍其前端代码,先看html页面,使用boostrap作为样式和布局,引入了bootstrap-daterangepicker插件作为日期范围选择面板,引入select2插件作为下拉选择列表,引入moment作为时间格式化工具,引入echarts作为图表库:
1.首先定义成员变量: int select1;// 人 选择 int select2;// 角色 选择 String choice1;// 人 选择结果 String choice2;// 机 选择结果 String choiceMan;// 角色 选择结果 boolean a1;// 人 循环开关 boolean a2;// 角色 循环开关 int random = (int) (Math.random() * 3);// 机 随机数选择
搭建动态博客的初衷就是想随时随地,只要一个浏览器,就能更新博客。那么就需要一个后台来管理文章,包含文章编辑器,和各种表单控件。
提到事务,你肯定会想到ACID(Atomicity、Consistency、Isolation、Durability,即原子性、一致性、隔离性、持久性),我们就来说说其中I,也就是“隔离性”。
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/hotqin888/article/details/78149202
laravel-admin的框架已经定义好的多级联动可以去官网查看,这里就不再进行赘述,但是使用中发现功能与想要的东西有些偏差,刚进来默认的时候不好用,就自己改了改,增加了一个默认的方法。
引言: Java是一门强大且广泛应用的编程语言,在开发过程中,准确地了解和使用Java标准库的API是非常重要的。JDK(Java Development Kit)是Java开发工具包,提供了丰富的API文档,其中包含了Java标准库中各种类和方法的详细说明。本文将为您介绍如何使用JDK 1.8 API帮助文档的中文版,帮助您事半功倍地进行Java编程。
包含在“/*”和“*/”之间,能注释很多行的内容。为了可读性比较好,一般首行和尾行不写注释信息(这样也比较美观好看),如图所示。
好了话不多说,上列子,解释都在注释里.有看不懂的可以留言大家一起交流哦. 文件链接(Python文件和数据库文件):
要开始写主体页面了,好头大。 首先需要梳理一下,如果写一条接口测试需要什么东西。 不如参考一下postman和httpbin~http://httpbin.org/ 不过这个页面太卡了,我决定把它部署在本地然后再测试。 使用docker好了,也不用管那些乱七八糟的环境了。 docker run -p 80:80 kennethreitz/httpbin 建议有空可以去了解一下docker,毕竟把乱七八糟的环境装在自己的电脑上还是蛮烦的,可能一下子遇到个环境问题就浪费一天。 使用这句话就可以把kennethreitz大神写的httpbin镜像下载并在我们的80端口上开启了。
很长时间没摸 windows 了, 发现自己居然 out 了,windows 也有类似 mac 的 brew 包管理器,
曾经,为了能畅通的浏览/使用GitHub而努力学习英语;现在,那股动力眼看就要被浇灭了。
背景:半年前,我从网上看到一个视频,讲的大概是一个人站在了一个人的旁边,待了几秒,然后就知道了那个人的银行卡信息了,而且不仅是银行卡信息,甚至连持卡人的姓名,身份证号都有。我看完之后,当时就惊呆了。现在的人都这么牛了吗?于是不假思索的也从网上买了一个一模一样的NFC读卡器,幻想着自己也可以这么厉害。可是货一到,热情就没了,因为当时以为很简单,哪知研究了一下竟不知从哪下手。不过好在也没浪费,拿着它配了个钥匙。就这样一晃半年过去了……最近我又看到了这个NFC读卡器,然后还找到了自己大学时期买的树莓派,心想着,是不是可以结合一下。最终功夫不负有心人,花了好几天的时间,终于把它们拼起来了!
对于专业程序猿来说,查找文档不是个什么难事,但VSTO开发者,多数是VBA开发者转型过来的,VBA开发者一般都是比较业余(笔者也是业余的开发,很幸运得到一位专业程序猿师傅全程陪伴成长)。一些看似很司空见惯的技能,可能很大部分VBA开发者还没掌握到。
将时间放远至整个人生,使用电脑过程中搜索文件的时间就非常之大,对此刚需进行一些效率提升,回报是足够大的。
ICSharpCode.SharpZipLib.dll 使用方法 https://blog.csdn.net/luhn12345/article/details/48090887
领取专属 10元无门槛券
手把手带您无忧上云