mrlolococo
mrlolococo

Reputation: 31

Smart Table not sorting properly

My column headers aren't sorting correctly with smart table. Instead of sorting individually they are all sorting together.

<thead>
    <tr>
        <th st-sort="field" ng-repeat="field in stat.q">{{field}}</th>
    </tr>
</thead>

Here is the javascript.

stat.q = ["Who is the coolest?", "What is your favorite color?", "Pick a movie", "Where do you want to go?", "test rating"];   

Upvotes: 1

Views: 265

Answers (2)

Kiko Castro
Kiko Castro

Reputation: 632

For usin ng-repeat you must put the braces around {{field}}:

<thead>
  <tr>
    <th st-sort="{{field}}" ng-repeat="field in stat.q">{{field}}</th>
  </tr>
</thead>

Upvotes: 3

TheJarvis
TheJarvis

Reputation: 26

I think you need to add a <tbody> then use the ng-repeat on a <tr> element.

Example with source code is here: http://lorenzofox3.github.io/smart-table-website/#section-sort

Upvotes: 0

Related Questions