简体   繁体   English

选择一个项目后,ui-select下拉列表将在其他字段之后打开

[英]Once an item is selected, ui-select dropdown opens behind other fields

I'm using ui-select in an angularjs app that repeats for every row in a table (ng-repeat). 我在angularjs应用程序中使用ui-select ,该应用程序对表中的每一行都重复(ng-repeat)。 This is the code for my ui-select. 这是我的用户界面选择的代码。

<ui-select name="{{'selProperty' + $index}}" ng-model="thing.property" 
 theme="bootstrap" ng-required="true">
    <ui-select-match placeholder="PLACEHOLDER TEXT">
        {{$select.selected.displayName}}
    </ui-select-match>
    <ui-select-choices repeat="property in data.properties | filter: $select.search">
        {{property.displayName}}
    </ui-select-choices>
</ui-select>

I have a list of things on my $scope.data object, and the containing table uses an ng-repeat="thing in data.things" . 我在$ scope.data对象上有东西列表,并且包含表使用ng-repeat="thing in data.things" In each row of the table are fields that the user fills out to set properties on the thing. 在表格的每一行中,都有用户填写以设置事物属性的字段。 The dropdown lets the user assign an object property of the thing. 下拉菜单允许用户分配事物的对象属性。

Everything works fine on first use. 首次使用时一切正常。 I get the list of properties and I can type in the partial search to filter the list. 我得到了属性列表,可以键入部分搜索以过滤列表。 I select one, check the thing and see that it's property is correctly set. 我选择一个,检查该事物,然后查看其属性是否正确设置。 The problem is that when I re-open the dropdown list after having selected a value, the entire list shows up behind the other ui-select boxes on the other rows of the table. 问题是,当我选择一个值后重新打开下拉列表时,整个列表显示在表其他行上的其他ui-select框后面。 I tried it on a non-repeating page, and it showed up behind an <input type="text"></input> box as well. 我在一个非重复页面上尝试过它,它也出现在<input type="text"></input>框的后面。

I've tried adjusting the z-index to ridiculous numbers with no luck. 我试过将z-index调整为可笑的数字,但是没有运气。 I copied out the source HTML before and after selecting a value and compared, but there were no differences. 在选择值之前和之后,我复制了源HTML并进行了比较,但是没有区别。 I really don't understand why my list is showing up behind the other input elements on the page. 我真的不明白为什么我的列表显示在页面上其他输入元素的后面。

Please check the github Issue link below: 请检查下面的github问题链接:

https://github.com/angular-ui/ui-select/issues/308 https://github.com/angular-ui/ui-select/issues/308

The solution is to add below CSS, See if it works for you. 解决方案是在CSS下方添加,看看它是否适合您。

   .ui-select-choices {
    position: fixed;
    top: auto;
    left: auto;
    width: inherit;
  }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM