1
我有3个按钮组,刷新按钮和表。 ALL |多佛|奥兰多刷新数据仅在过滤条件
在页面加载时,通过调用api将所有数据显示在表中。
使用angularjs过滤器我已经过滤了基于城市的数据,即Dover或Orlando。
当前场景: 当用户在Dover上并点击刷新按钮时,所有的数据被再次加载,即ALL和Refresh具有相同的API调用。
所需方案: 当用户在Dover上并单击刷新按钮时,Dover数据应刷新。
代码:
<div class="myrow">
<div class="col-md-6 col-sm-6">
<label for="documentStatus">Queues: </label>
<div class="btn-group" role="group" aria-label="...">
<button type="button" class="btn btn-primary active" ng-click="updateData(); myFilter = null">ALL</button>
<button type="button" class="btn btn-primary" ng-click="myFilter = {city : 'Dover'}">Dover</button>
<button type="button" class="btn btn-primary" ng-click="myFilter = {city : 'Orlando'}">Orlando</button>
</div>
</div>
</div>
<div class="container" ng-init="updateData()">
<div class="pull-right">
<button type="button" class="btn btn-primary btn-md" value="Refresh" ng-click="myFilter = null; updateData()">
<span class="glyphicon glyphicon-refresh"></span> Refresh
</button>
</div>
<table class="table table-bordered">
<thead>
<tr>
<th></th>
<th>Queue</th>
<th>No of Documents</th>
<th>Oldest document Datetime</th>
<th>Allocated Users</th>
</tr>
</thead>
<tbody ng-repeat="queue in Queues | filter: myFilter">
<tr>
<td>
<label class="checkbox-table">
<input type="checkbox" name="checkbox" ng-model="queue.isChecked" id="check-box-{{$index}}">
</label>
</td>
<td class="col-md-3">{{ queue.queue }}</td>
<td class="col-md-2">{{ queue.noOfDocuments }}</td>
<td class="col-md-2">{{ queue.oldestDoc}}</td>
<td class="col-md-5">{{ queue.allocatedUsers}}</td>
</tr>
</tbody>
</table>
</div>
这听起来更像是一个后端的问题给我,如果你只是想获取由过滤资源城市'奥兰多'。 如果您使用的是angulars'http http',您可以引入'parameters'属性,该属性将转换为ajax调用中的'GET'参数。 –
为以上代码添加代码.. –
你的'update function'在哪里? – developer033