Custom sorting in ngTable using AngularJs -


i looking forward custom sorting in ngtable, according http://ng-table.com/#/
replacing default sorting algorithm custom sort still pending. in case, want sort dataset respect days of week i.e, starting monday , ending @ sunday.

there way this?

kind of , suggestions appreciated.

on day, have column display 1 property , sort on another. suggest having object dayname , daysort, dayname day of week ("monday") , daysort sort order (1). see working codepen below.

http://codepen.io/storytimesolutions/pen/nndvzo

table:

<table ng-table="demo.tableparams" show-filter="true" class="table table-bordered table-striped">       <tr ng-repeat="row in $data track row.id">         <td title="'day of week'" filter="{dayname: 'text'}" sortable="'daysort'">{{row.dayname}}</td>         <td title="'workout'" filter="{workoutplan: 'text'}" sortable="'workoutplan'">{{row.workoutplan}}</td>       </tr> </table> 

stubbed data:

data: [         {id: 1, dayname: "monday", daysort: 1, workoutplan: "run"},         {id: 2, dayname: "thursday", daysort: 4, workoutplan: "swim"},         {id: 3, dayname: "friday", daysort: 6, workoutplan: "jog"},         {id: 4, dayname: "friday", daysort: 6, workoutplan: "tennis"},         {id: 5, dayname: "saturday", daysort: 7, workoutplan: "volleyball"}       ] 

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -