【发布时间】:2017-03-01 00:48:10
【问题描述】:
我生成了一个 Jhipster 实例,它有一个人实体和一个家庭链接实体。
在人员实体中,我列出了一群人。在家庭链接中,我想将它们链接在一起。即 A 是 B 的儿子,C 是 D 的妻子等等。
在家庭链接“添加新”页面上,我想要一些带有搜索功能的下拉列表,其中列出了来自 Person Entity 的所有人员。有东西链接这个:
- 姓名:John Doe
- 父亲:(人员下拉列表)
- 母亲:(人员下拉列表)
- 孩子:(人员下拉列表)
我尝试过使用这样的代码:
<div class="form-group">
<label translate="archerApp.familyLink.child" for="field_child">Child</label>
<ui-select ng-model="vm.familyLink.child" id="field_child" ng-disabled="disabled" >
<ui-select-match placeholder="Select or search a person name in the list...">{{$select.selected.firstname + ' ' + $select.selected.lastname}}</ui-select-match>
<ui-select-choices repeat="person in vm.people | filter: $select.search track by person.id"
refresh="refreshPerson($select.search)" refresh-delay="0">
<span ng-bind-html="(person.firstname+' '+person.lastname) | highlight: $select.search"></span>
</ui-select-choices>
</ui-select>
</div>
问题是这段代码只能列出来自 Person 实体的前 20 个人。我想我应该使用 ElasticSearch API 之类的,
<form name="searchForm" class="form-inline">
<div class="input-group pull-right" >
<input type="text" class="form-control" ng-model="vm.searchQuery" id="searchQuery" placeholder="{{ 'archerApp.person.home.search' | translate }}">
<span class="input-group-btn width-min" >
<button class="btn btn-info" ng-click="vm.search(vm.searchQuery)">
<span class="glyphicon glyphicon-search"></span>
</button>
</span>
<span class="input-group-btn width-min" ng-if="vm.currentSearch">
<button class="btn btn-info" ng-click="vm.clear()">
<span class="glyphicon glyphicon-trash"></span>
</button>
</span>
</div>
</form>
这是 Person 实体上搜索栏的代码。但我不知道如何使它与工作列表一起使用。
谢谢。
【问题讨论】:
标签: angularjs search filter jhipster