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
Solved

Sorting grid by multiple columns in angularjs

Posted on 2016-11-07
3
54 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

840 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