0

I'm working with nested table Example data:

$scope.building =
    [
      {
        "id": 1,
        "name": "first",
        "ownBlock": [
          {
            "id": 1,
            "name": "Block 1"
          },
          {
            "id": 2,
            "name": "Block 2"
          }
        ]
      },
      {
        "id": 2,
        "name": "second",
        "ownBlock": [
          {
            "id": 3,
            "name": "Block 1"
          },
          {
            "id": 4,
            "name": "Block 2"
          }
        ]
      }
    ]

When I sort ownBlock of id 2 , It will sort child data of Id 1 too

<tr ng-repeat="block in data.ownBlock| orderBy : sortColumn.Field : sortColumn.Order">.... </tr>

I know the reason but I dont have solution to fix that . Hope it helps

3
  • What actual sort order do you want in your data? Commented Mar 8, 2017 at 4:44
  • do you want the child data not to be sorted ? Commented Mar 8, 2017 at 5:02
  • Thank for your answers , I want to sort child data bro . But my issue is when I sort child data which has parent Id 2 name "second" , child data of id 1 name first is sorted too , i dont want that , i just want only child data of id 2 is sorted Commented Mar 8, 2017 at 5:56

1 Answer 1

2

if you dont want the child to be sorted try this

$scope.building = $filter('orderBy')($scope.building,'id');
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.