Solved

Sorting grid by multiple columns in angularjs

Posted on 2016-11-07
3
67 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
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…
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…

726 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