1

I have got a table which I want to be able to search through. It works great for the quiz title but the course title doesn't seem to work. I know it is because the course title is inside another dictionary, because if I put "course" instead of "course.title" it works, but it searches inside the whole course object instead of just for the title, which I don't want it to. How can I get search for only the course.title? I think it is only a matter of syntax but I can't find a similar problem anywhere.

<table  st-table="displayedQuizzes" st-safe-src="quizzes" class="table table-striped">
    <thead>
        <tr>
            <th st-sort="quiz.title">Name</th>
            <th st-sort="quiz.course.title">Course</th>
        </tr>
        <tr>
            <th><input st-search="'title'" class="input-sm form-control" placeholder="Search ..." type="search"/></th>
            <th><input st-search="'course.title'" class="input-sm form-control" placeholder="Search ..." type="search"/></th>           
        </tr>
    </thead>
    <tbody>
        <tr  ng-repeat="quiz in displayedQuizzes">
            <td>{{quiz.title}}</td>
            <td>{{quiz.course.title}}</td>          
        </tr>
    </tbody>   
</table>

This is my angular code:

angular.module('App')
.controller('ArchiveCtrl', ['$scope', '$window', 'Archive, function ($scope, $window, Archive) {
    $scope.quizzes = Archive.query();   
}]);
arfasvin
  • 13
  • 5
  • Can you show the angular code? – Gericke Sep 25 '15 at 09:53
  • there is an error in the controller declaration `.controller('ArchiveCtrl', ['$scope', 'Archive, function ($scope, $window, Archive) {` - you didn't define `$window` as input parameter. – Michael Sep 25 '15 at 10:20

2 Answers2

0

Are you sure you have to wrap the st-search value in quotes? the smart tables documentation doesn't use quotes.

http://lorenzofox3.github.io/smart-table-website/

        <input st-search="firstName" placeholder="search for firstname" class="input-sm form-control" type="search"/>
Michael
  • 3,085
  • 1
  • 17
  • 15
  • If I don't, neither the quiz title nor the course.title works. But I have tried every possible combination of quotes and nothing seems to work for the course.title. – arfasvin Sep 25 '15 at 10:04
  • To support you please provide a running plunker. – Michael Sep 25 '15 at 10:17
0

Have a look at this stacktrace question

Nested search is not supported by smart-table.js

Community
  • 1
  • 1
Michael
  • 3,085
  • 1
  • 17
  • 15