daniel-nagy / md-data-table

Material Design Data Table for Angular Material
MIT License
1.9k stars 520 forks source link

md-order-by is an expression #606

Closed velusgautam closed 7 years ago

velusgautam commented 7 years ago

My column is an expression on column value.

eg:

<md-table-container>
  <table md-table>
    <thead md-head md-order="myOrder">
      <!-- when the user clicks this cell, the myOrder variable will get the value 'nameToLower' -->
      <th md-column md-order-by="dessert.value">Dessert (100g serving)</th>
      <!-- the variable myOrder will not be changed when this cell is clicked -->
      <th md-column md-numeric>Calories</th>
    </thead>
    <tbody md-body>
      <!-- we can let ng-repeat sort the columns for us -->
      <tr ng-repeat="dessert in desserts | orderBy: myOrder">
        <td>{{ (dessert.value1 == 0)?0 : dessert.value2)}}</td>
    </tr>
    </tbody>
  </table>
</md-table-container>

what should I give in md-order-by

velusgautam commented 7 years ago

I findout the answer. It can take expressions like

Calories