Solved

Sorting grid by multiple columns in angularjs

Posted on 2016-11-07
3
42 Views
Last Modified: 2016-11-09
Hi
I need to do Sorting grid with multiple columns in angularjs
Thanks
0
Comment
Question by:Member_2_7967608
  • 2
3 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 41878085
<gridrow ng-repeat="row in rows | orderBy:['column1','column3','column2','column0']">
    <gridcell>{{row.column0}}</gridcell>
    <gridcell>{{row.column1}}</gridcell>
    <gridcell>{{row.column2}}</gridcell>
    <gridcell>{{row.column3}}</gridcell>
    <gridcell>{{row.column4}}</gridcell>
    <gridcell>{{row.column5}}</gridcell>
</gridrow>

Open in new window

0
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 41878268
Test page : https://jsfiddle.net/ymdbp8zt/1/

<div ng-app="myApp">
  <table ng-controller="myCtrl">
    <tr ng-repeat="row in rows | orderBy:['column1','column3','column2','column0']">
        <td>{{row.column0}}</td>
        <td>{{row.column1}}</td>
        <td>{{row.column2}}</td>
        <td>{{row.column3}}</td>
        <td>{{row.column4}}</td>
        <td>{{row.column5}}</td>
    </tr>
  </table>
</div>

Open in new window


var myApp = angular.module("myApp", []);
myApp.controller("myCtrl", ["$scope", function($scope) {
	$scope.rows = [
		{column0:"A",column1:"4",column2:"123",column3:"AZD"},  
		{column0:"A",column1:"3",column2:"124",column3:"AZC"},  
		{column0:"A",column1:"3",column2:"123",column3:"AZC"},  
		{column0:"B",column1:"0",column2:"123",column3:"AZA"},  
		{column0:"A",column1:"0",column2:"123",column3:"AZA"}  
  ];
}]);

Open in new window

0
 

Author Comment

by:Member_2_7967608
ID: 41880378
Thanks
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
You have this traditional web application that refreshes the whole page each time you navigate and you think it's a good time to convert it to a Single-Page approach. What should you know in advance? Read on, I'll guide you through it.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now