angularjs - 智能表 Angularjs 外部搜索框

标签 angularjs smart-table

早上好,我的 angualrJS spa 上有一个智能表格,但出于 UI 设计目的,我需要将搜索字段放在表格之外。能做到吗?这是我的表的示例代码

<table st-table="displayedCollection" st-safe-src="rowCollection" class="table table-striped">        
  <thead>
    <tr>
      <th>Tipo</th>
      <th>Da</th>
      <th>A</th>
      <th>Data</th>
      <th>Durata</th>
      <th>Costo</th>
    </tr>
    <tr>
      <th></th>
      <th></th>
      <th><input st-search="'destination'" /></th>
      <th><input st-search="'answerTime'" /></th>
      <th><input st-search="'duration'" /></th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <tr ng-repeat="row in displayedCollection">
      <td></td>
      <td></td>
      <td>{{row.destination}}</td>
      <td>{{row.answerTime | date : 'short'}}</td>
      <td>{{row.duration | number}}</td>
      <td>{{row.cost | currency : '€'}}</td>
    </tr>
  </tbody>
  <tfoot>
    <tr>
      <td colspan="5" class="text-center">
        <div st-pagination="" st-items-by-page="itemsByPage" st-displayed-pages="5"></div>
      </td>
    </tr>
  </tfoot>
</table>

我需要将 st-search 字段(或类似的字段)放在标签之外。

这里是示例,顶部是默认的,底部是所需的

/image/eRvwM.jpg

最佳答案

您可以尝试将表格包装在如下包装器中:

<div st-table="displayedCollection" st-safe-src="rowCollection">

   <input st-search="'destination'" />
   <input st-search="'answerTime'" />
   <input st-search="'duration'" />

   <table class="table table-striped">
      <thead>
         <tr>
            <th>Tipo</th>
            <th>Da</th>
            <th>A</th>
            <th>Data</th>
            <th>Durata</th>
            <th>Costo</th>
         </tr>
      </thead>
      <tbody>
         <tr ng-repeat="row in displayedCollection">
            <td></td>
            <td></td>
            <td>{{row.destination}}</td>
            <td>{{row.answerTime | date : 'short'}}</td>
            <td>{{row.duration | number}}</td>
            <td>{{row.cost | currency : '€'}}</td>
          </tr>
      </tbody> 
    </table>
 </div>

对我来说,这很完美。

关于angularjs - 智能表 Angularjs 外部搜索框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29234119/

相关文章:

javascript - 如何使用 AngularJS 处理数据的递归呈现

javascript - 带有对象的 AngularJS 数组

javascript - 如何使按钮在 AngularJS 的智能表格的第一页和最后一页上跳过

javascript - 选择所有行无法与复选框一起正常工作

javascript - 如何在 Angular js 智能表中编辑内容

node.js - ng-view 不能在 AngularJS/Express 中使用部分

javascript - NodeJS/Angular 编辑请求收到 400 错误

javascript - 如何将位置按钮设置为底部?

javascript - Angularjs 的智能表模块 - 与处理其指令相关的问题