如何实现带有锁定选择的select2? [英] How to implement select2 with lock selection?

查看:89
本文介绍了如何实现带有锁定选择的select2?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将select2与一个禁用值一起使用.

I am trying to use select2 with one disabled value.

我正在尝试将其实现为

$('#select_currency').select2('data', preloaded_data);

我一直在阅读有关锁定选择的信息,但是我无法实现,请您让我知道如何实现它的人,或者有任何有关它的教程.

I have been reading about Lock selections but I am not able to implement it, could you please someone let me know how to implement it or is there any tutorial about it.

推荐答案

如果使用v3.5 但是在v.4.x中,此功能已删除.

But in v.4.x this functionality is removed.

我已经找到了v.4.x的解决方案(或hack :),但由于控制台错误而有点脏,但是它可以工作.无论如何,这是我发现的最好的解决方案.检查我的jsfiddle:

I've found solution (or hack:) ) for v.4.x, a little bit dirty with error in console, but it works. Anyway it is best solution what I've found. Check my jsfiddle:

https://jsfiddle.net/o3s3y42e/4/

这篇关于如何实现带有锁定选择的select2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆