angularjs - Deal with formatted columns and search feature in smart-table -


can me search formatted columns? using global search, in smart-table examples (and code too), if format column (money filter example), , original value 102, , show $102.00 on columns, , user entry 102.00, search feature not find value, cause original value 102, not 102.00 (with dot , zeros), how can deal it? thanks

i'm guessing using input textbox st-search directive on filter numeric value column in markup format using angular filter. this?

<table st-table="collection">     <tr>         <td>id</td>         <td>cost</td>     </tr>     <tr>         <td><input st-search="id" type="search"/></td>         <td><input st-search="cost" type="search"/></td>     </tr>     <tr ng-repeat="row in collection">         <td>{{row.id}}</td>         <td>{{row.cost | currency}}</td>     </tr> </table> 

there several ways go this:

  • if value display only, may preformat before putting on scope consumption. bring other benefits; when numeric has decimals not have problems rounding on second decimal place in currency filter , searchable base value, filter not evaluated each digest cycle improves performance large , complex datasets , requires no other change code preformatting property , removing currency filter.
  • you may choose implement own search directive may apply logic value before passing on smart table (see stnumberrange directive in plunker below how implement own search plugin).
  • create own filter comparison logic fixes issue (see plunker , query object in directive customfilter)

http://plnkr.co/edit/idbc1jnhkylhux6mnwz6?p=preview


Comments