Ui-select:当数据为空数组时,搜索框未显示以进行搜索

问题描述 投票:0回答:1

我有一个ui-select,只要用户在输入框(搜索框)中插入一个字符,就会使用刷新从服务器获取数据。问题是当数据是空数组时输入框不可用,因此用户无法搜索以获取数据。不用说,我只想在用户搜索数据时显示数据。

这只发生在主题“select2”中。使用bootstrap主题它正在工作。

<ui-select id="client" name="client" ng-model="search._client" theme="select2" ng-change="loadInventories()">
<ui-select-match ng-show="$select.isEmpty()" allow-clear="true" placeholder="{{'CLIENT' | translate}}">{{$select.selected.name | translate}}</ui-select-match>
<ui-select-choices repeat="client in filtered_clients | filter: $select.search | orderBy:'name' | limitTo: 5"  refresh="load_filtred_clients($select.search)" refresh-delay="0">
 <div>{{client.name | translate}}</div>
    </ui-select-choices>
    </ui-select>

有没有办法在数组为空时显示搜索框?

javascript angularjs jquery-select2 angular-ui ui-select
1个回答
1
投票

听起来'select2'主题是在数组为空时将disabled HTML属性添加到搜索框中。

你可以尝试找到'select2'主题添加disable属性的代码,并编辑它(不推荐)或以某种方式覆盖它:

element.removeAttribute("disabled");

© www.soinside.com 2019 - 2024. All rights reserved.