【问题标题】:Ui-select : Search box not shown to search when data is an empty arrayui-select:当数据为空数组时不显示搜索框进行搜索
【发布时间】:2019-04-20 22:46:42
【问题描述】:

我有一个用户界面选择,只要用户在输入框(搜索框)中插入一个字符,它就会使用刷新从服务器获取数据。 问题是当数据为空数组时输入框不可用,因此用户无法搜索以获取数据。 不用说,我只想在用户搜索时呈现数据。

这只发生在主题“select2”上。 使用 boostrap 主题,它正在工作。

<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>

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

【问题讨论】:

  • 我遇到了同样的问题,这是一个错误。 ui-select 存储库现已存档,但您有一个出色的 PR,fix for this issue

标签: javascript angularjs jquery-select2 angular-ui ui-select


【解决方案1】:

当数组为空时,听起来“select2”主题正在将disabled HTML 属性添加到您的搜索框。

您可以尝试找到“select2”主题添加禁用属性的代码,然后对其进行编辑(不推荐)或以某种方式覆盖它:

element.removeAttribute("disabled");

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-07-24
    • 1970-01-01
    • 2020-02-01
    • 1970-01-01
    • 2023-04-09
    • 1970-01-01
    • 1970-01-01
    • 2014-06-06
    相关资源
    最近更新 更多