2016-10-14 4 views
0

Angular js의 테이블 위에 필터를 만들어야합니다. 나는이 코드를 가지고 있지만 작동하지 않는다. 여기에, 나는 2 개의 드롭 다운을 가지고있다 : eat_code와 feeling_code를 위해 그리고 나는 그들 각각을 선택하고 난 후에 행을 걸러 내고 싶다.드롭 다운 메뉴를 사용하여 AngularJS 필터 테이블

<div class="widgets"> 
    <div class="row"> 
    <div class="col-md-12"> 
     <div class ="panel"> 
     <div class="panel-heading"> 
      <h3 class="panel-title">Select PID</h3> 
     </div>   
     <div class="panel-body"> 
      <form class="row form-inline ng-pristine ng-valid ng-scope" 
       novalidate name="getBGsForm"> 
      <div class="form-group col-sm-3 col-xs-6" 
       ng-class="{'has-error': getBGsForm.patientID.$invalid && (getBGsForm.patientID.$dirty || getBGsForm.$submitted)}"> 
       <input type="text" class="form-control" 
        ng-model="patientID" 
        placeholder="PID" 
        required name="patientID"> 
       <span class="help-block error-block basic-block" 
        ng-if="getBGsForm.patientID.$error.required">Patient ID is required.</span> 
      </div> 
      <button type="submit" 
        class="btn btn-primary" 
        ng-click="getBGs()">Show BGs</button> 
      </form> 
     </div> 
     </div> 
     <div ba-panel> 
     <div> 
      <div class="col-md-4"> 
      <select class="form-control" 
        ng-model="search.eat_code" 
        ng-options="v.code as (v.code + ' - ' + v.label) for v in dropdownValuesTag"> 
       <option value=""> --- filter by meal tag --- </option> 
      </select>     
      </div> 
      <div class="col-md-4"> 
      <select class="form-control" 
        ng-model="search.feeling_code" 
        ng-options="v.code as (v.code + ' - ' + v.label) for v in dropdownValuesSource"> 
       <option value=""> --- filter by source --- </option> 
      </select>  
      </div> 
     </div> 
     </div> 
     <div ba-panel> 
     <div class="horizontal-scroll"> 
      <div class="form-group select-page-size-wrap "> 
      <label>Rows on page 
       <select class="form-control selectpicker show-tick" 
         title="Rows on page" selectpicker 
         ng-model="smartTablePageSizeBG" 
         ng-options="i for i in [5, 10, 15, 20, 25]"> 
       </select> 
      </label> 
      </div> 
     </div> 
     <table class="table" st-table="displayedCollectionBG" st-safe-src="smartTableDataBG" st-set-filter = "myStrictFilter"> 
      <thead> 
      <tr class="sortable "> 
       <th st-sort="id">Reading Id</th> 
       <th st-sort="value">Value</th> 
       <th st-sort="unit">Unit</th> 
       <th st-sort="timestamp">Timestamp</th> 
       <th st-sort="is_control">Is Control</th> 
       <th st-sort="source">Source</th> 
       <th st-sort="eat_code">Eat Code</th> 
       <th st-sort="feeling_code">Feeling Code</th> 
       <th st-sort="carb"> Carb</th> 
       <th st-sort="note"> Note</th> 
       <th st-sort="storedTimestamp">Stored Timestamp</th> 
       <th st-sort="adaTargetRangeStatus">adaTargetRangeStatus</th> 
       <th>Actions</th> 
      </tr> 
      </thead> 
      <tbody> 
      <tr ng-repeat="item in displayedCollectionBG | filter: search"> 
       <td class="table-id">{{item.id}}</td> 
       <td>{{item.value}}</td> 
       <td>mg/dl</td> 
       <td><span ng-bind="item.timestamp | date:'MM/dd/yyyy hh:mm:ss a'"></span></td> 
       <td>{{item.tags.is_control}}</td> 
       <td>{{item.tags.source}}</td> 
       <td>{{item.tags.eat_code}}</td> 
       <td>{{item.tags.feeling_code}}</td> 
       <td>{{item.tags.carb}}</td> 
       <td>{{item.tags.note}}</td> 
       <td><span ng-bind="item.storedTimestamp | date:'MM/dd/yyyy hh:mm:ss a'"></span></td> 
       <td>{{item.adaTargetRangeStatus}}</td> 
       <td> 
       <div class="buttons"> 
        <a class="btn btn-primary editable-table-button btn-xs" ui-sref="BGs.form({id: {{item.id}}})" ui-sref-opts="{reload: true}">Edit</a> 
       </div> 
       </td> 
      </tr> 
      </tbody> 
      <tfoot> 
      <tr> 
       <td colspan="6" class="text-center"> 
       <div st-pagination="" st-items-by-page="smartTablePageSizeBG" st-displayed-pages="5"></div> 
       </td> 
      </tr> 
      </tfoot> 
     </table> 
     </div> 
    </div> 
    </div> 
</div> 

내가 뭘 잘못하고 있니? 고맙습니다!

답변

0

이 시도 : click here 그것에서

, 당신이 선택해야 '아약스 열 필터 지원 (NEW!)'하고 데모를 얻을 것이다 오른쪽, 그냥 모든 열 헤더를 클릭, 당신은 열을 기반으로 필터를 얻을 것이다 .

관련 문제