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

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

问题描述

我有问题使这个plunkr(select2 + angulat-ui)工作。





看起来像是select2的行为折叠到第一个元素的宽度。我可以通过引导 class =input-medium设置宽度.Stam不确定为什么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天全站免登陆