angularjs-orderby

AngularJS Paging orderBy only affects displayed page

半城伤御伤魂 提交于 2019-12-03 06:05:54
Can anyone point me in the right direction to figure out a way to fix the way paging and orderBy work together in Angular? Currently, I can orderBy and page the results of the data[], but the orderBy filter only affects the each page individually. For example, if I sort in reverse order by ID, page 1 will list 10-1, and page 2 will list 15-11, as opposed to starting with 15 and going to 1 by the end of the second page. I have a basic fiddle here http://jsfiddle.net/ZbMsR/ Here is my controller: function MyCtrl($scope) { $scope.currentPage = 0; $scope.pageSize = 10; $scope.orderBy = "-appId";

Disabling orderBy in AngularJS while editing the list

北慕城南 提交于 2019-12-01 02:29:42
After applying orderBy in my list of input boxes if i edit any field it starts sorting immediately and i loose focus. I tried to dug in the angular code and found out they have applied something like $watch on the orderBy's attributes therefore whenever the value changes it sorts the list.Is there any way to disable orderBy while editing? I dont want to let the orderBy sort data while editing text. Any help will be appreciated Here is my plunker Note : I want to use orderBy & don't need any alternative like sorting the list from any controller itself. I just want the orderBy to sort the list

Disabling orderBy in AngularJS while editing the list

本小妞迷上赌 提交于 2019-11-30 22:08:17
问题 After applying orderBy in my list of input boxes if i edit any field it starts sorting immediately and i loose focus. I tried to dug in the angular code and found out they have applied something like $watch on the orderBy's attributes therefore whenever the value changes it sorts the list.Is there any way to disable orderBy while editing? I dont want to let the orderBy sort data while editing text. Any help will be appreciated Here is my plunker Note : I want to use orderBy & don't need any

Custom order using orderBy in ng-repeat

喜夏-厌秋 提交于 2019-11-28 18:51:07
I have objects like this: students = {name: 'Aa_Student', class: 'A_Class'}, {name: 'Ab_Student', class: 'A_Class'}, {name: 'Ac_Student', class: 'B_Class'}, {name: 'Ba_Student', class: 'B_Class'}, {name: 'Bb_Student', class: 'C_Class'}, {name: 'Bc_Student', class: 'C_Class'} Let's say the students object is shuffled. I use ng-repeat to show the data. I want to sort the objects in the custom order. For example, I want to show the data like this: Name Class ----------------------------- Ac_Student B_Class Ba_Student B_Class Aa_Student A_Class Ab_Student A_Class Bb_Student C_Class Bc_Student C

Angular orderBy object possible?

你离开我真会死。 提交于 2019-11-28 01:08:44
I have a JSON object representing calendar dates. These are added through a CMS and I'd like to be able to filter them based on date. My schema set-up has made this more difficult than I thought. Is it possible to orderBy the day value in this JSON object or is there a filter workaround? Here is my JSON object: { "_id" : ObjectId("53f252537d343a9ad862866c"), "year" : { "December" : [], "November" : [], "October" : [], "September" : [], "August" : [], "July" : [ { "day" : "21", "title" : "Event Title", "summary" : "Event Summary", "description" : "oEvent Description", "_id" : ObjectId(

Orderby not working with dict syntax on ng-repeat

怎甘沉沦 提交于 2019-11-27 22:39:45
I am trying to use ng-repeat with a dictionary style syntax and apply an order to the key value. (key, value) in something | orderBy:'key' It seems OrderBy isn't working as expected Example here http://jsfiddle.net/mhXuW/ The parameters to orderBy must match property names in an array of objects. Your data needs to look something like this: $scope.list2 = [ { id:"2013-01-08T00:00:00", name:'Joe'}, { id:"2013-01-09T00:00:00", name:'Sue'}]; Then a filter like this will work: <div ng-repeat="item in list2 | orderBy:'id':true"> Fiddle . Note that orderBy works on the entire array ( something in

Angularjs wrong $index after orderBy

冷暖自知 提交于 2019-11-27 03:05:38
I am new to Angular.js and have some problems sorting my array and working on that sorted data. I have a list with items and want so sort it by "Store.storeName", which is working so far. But after sorting the data, my delete-function is not working anymore. I think thats because the $index is wrong after sorting, and so the wrong data is deleted. How can I solve that? Ordering the data in the scope and not in the view? How to do that? Here is some relevant code: In the View: <tr ng-repeat="item in items | orderBy:'Store.storeName'"> <td><input class="toggle" type="checkbox" ng-model="item

random orderBy in AngularJS 1.2 returns 'infdig' errors

社会主义新天地 提交于 2019-11-27 02:21:37
Using the random orderBy sort technique in this question works fine in AngularJS 1.1. var myApp = angular.module('myApp',[]); function MyCtrl($scope) { $scope.list = ['a', 'b', 'c', 'd', 'e', 'f', 'g']; $scope.random = function() { return 0.5 - Math.random(); } } In 1.2, though, it puts infdig errors into the console and takes a much longer time to return the sorted results: http://jsfiddle.net/mblase75/jVs27/ The error in the console looks like: Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting! Watchers fired in the last 5 iterations: [["fn: $watchCollectionWatch; newVal:

Angular orderBy object possible?

北战南征 提交于 2019-11-26 23:29:16
问题 I have a JSON object representing calendar dates. These are added through a CMS and I'd like to be able to filter them based on date. My schema set-up has made this more difficult than I thought. Is it possible to orderBy the day value in this JSON object or is there a filter workaround? Here is my JSON object: { "_id" : ObjectId("53f252537d343a9ad862866c"), "year" : { "December" : [], "November" : [], "October" : [], "September" : [], "August" : [], "July" : [ { "day" : "21", "title" :

orderBy multiple fields in Angular

点点圈 提交于 2019-11-26 15:40:29
How to sort by using multiple fields at same time in angular? fist by group and then by sub-group for Example $scope.divisions = [{'group':1,'sub':1}, {'group':2,'sub':10}, {'group':1,'sub':2},{'group':1,'sub':20},{'group':2,'sub':1}, {'group':2,'sub':11}]; I wanted to display this as group : Sub-group 1 - 1 1 - 2 1 - 20 2 - 1 2 - 10 2 - 11 <select ng-model="divs" ng-options="(d.group+' - '+d.sub) for d in divisions | orderBy:'group' | orderBy:'sub'" /> Please see this: http://jsfiddle.net/JSWorld/Hp4W7/32/ <div ng-repeat="division in divisions | orderBy:['group','sub']">{{division.group}}-{