could you please tell me how to sort array in ascending or descending order on button click .Actually I have a button on header "V" .using button click I want to display data in ascending order .Actually I am making a grid view in Ionic using angular js .But I want to sort that using button click .I need to sort table according to first column .Because user click on first column "V".
here is my code
http://plnkr.co/edit/UloVItuyLLvmeo34R4gX?p=preview
Expected result after button click
Calls Royal Dutch sell
p a royal data
Xgtyu test royal data
can we sort the column and display on view on button click ?
<div class="row gray-20 mrginrightleft">
<div class="col col-center " ng-repeat="d in data | filter:{checked: true}"><i class="button button-icon icon ion-arrow-down-b" ng-click="sortdata()"></i><strong>{{d.label}}</strong></div>
<div class="col col-10 text-center ">
<button class=" button-icon icon ion-gear-b" ng-click="openPopover($event)"></button>
</div>
</div>
<div class="row mrginrightleft" ng-repeat="column in displayData | filter: query">
<div class="col col-center brd" ng-repeat="field in column.columns" ng-show="data[$index].checked && data[$index].fieldNameOrPath===field.fieldNameOrPath">{{field.value}}</div>
<div class="col col-10 text-center brd">
</div>
</div>