设置 select2 输入的宽度(通过 Angular-ui 指令) [英] set the width of select2 input (through Angular-ui directive)

查看:38
本文介绍了设置 select2 输入的宽度(通过 Angular-ui 指令)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使这个 plunkr (select2 + angulat-ui) 工作时遇到问题.

看起来折叠到第一个元素的宽度是select2的行为.我可以通过 bootstrap class="input-medium" 设置宽度.仍然不知道为什么 angular-ui 不接受配置参数.

解决方案

需要指定属性宽度来解析以保留元素宽度

$(document).ready(function() {$("#myselect").select2({ width: 'resolve' });});

I have problem making this plunkr (select2 + angulat-ui) work.

http://plnkr.co/edit/NkdWUO?p=preview

In local setup, I get the select2 work, but I cannot set the width as described in the docs. It is too narrow to be used.

Thank you.

EDIT: Never mind that plnkr, I found a working fiddle here http://jsfiddle.net/pEFy6/

It looks like it is the behavior of select2 to collapse to the width of first element. I could set the width through bootstrap class="input-medium" .Still not sure why angular-ui doesn't take config parameters.

解决方案

You need to specify the attribute width to resolve in order to preserve element width

$(document).ready(function() { 
    $("#myselect").select2({ width: 'resolve' });           
});

这篇关于设置 select2 输入的宽度(通过 Angular-ui 指令)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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