1

先行入力機能を組み合わせたスマートテーブルを作成しました。

  <input type="text" class="form-control" ng-click="selectPerson()" ng-model="selectedPerson"
           bs-options="person.firstName for person in rowCollection" placeholder="Search for person" bs-typeahead>

    <table st-table="displayedCollection" st-safe-src="rowCollection" class="table table-striped">
        <thead>
        <tr>
            <th st-sort="firstName">first name</th>
            <th st-sort="lastName">last name</th>
            <th st-sort="birthDate">birth date</th>
            <th st-sort="balance">balance</th>
        </tr>

        </thead>
        <tbody>
        <tr ng-repeat="row in displayedCollection">
            <td>{{row.firstName}}</td>
            <td>{{row.lastName}}</td>
            <td>{{row.birthDate}}</td>
            <td>{{row.balance}}</td>
            <td>
                <button type="button" ng-click="removeItem(row)" class="btn btn-sm btn-danger">
                    <i class="glyphicon glyphicon-remove-circle">
                    </i>
                </button>
            </td>
        </tr>
        </tbody>
    </table>

目標は、検索入力でテーブル内の人を検索し、名前を選択して、その下のスマートテーブルに表示することです。人を選択すると、これが発火します:

$scope.selectPerson = function(){
    $scope.displayedCollection = $scope.selectedPerson;
    console.log($scope.displayedCollection );
}

ただし、テーブルに人物は表示されません。人を表示するように修正するにはどうすればよいですか?

plunkr: http://plnkr.co/edit/NXEbl5?p=preview

4

0 に答える 0