0

I have a following table of grouped items:

Grouped Items

I want to display each item in dropdown rows under particular group. Would you mind to help how to make this with Angular JS?

I'm fetching all groups and items with a single JSON:

[
{"City":"NY",
"notes":"bla-bla",
"state":"Created",
,"description":"asdasdasda",
"locationId":1,
"waybillId":"",
"itemCount":3
"items":[{"itemId": "0001","status":"Created", "weight":23},
         {"itemId": "0002","status":"Created", "weight":23}
         {"itemId": "0003","status":"Created", "weight":23}
        ]

},

....

]

HTML:

<table class="table table-bordered">
    <thead>
        <tr>
            <th>#</th>
            <th>City</th>
            <th>Waybill</th>
            <th>Items</th>
            <th>Status</th>
            <th>Action</th>
        </tr>
    </thead>
    <tbody>
        <tr ng-repeat="group in groupItems">
            <td>{{$index+1}}</td>
            <td>{{group.city}}</td>
            <td>{{group.waybillId}}</td>
            <td>{{group.itemCount}}</td>
            <td>
                <span class="label label-success">{{group.state}}</span>
            </td>
            <td>
                <button class="">Ungroup</button>
            </td>
        </tr>
    </tbody>
</table> 

1 Answer 1

2

For level 1,

<tbody data-ng-repeat="storedata in storeDataModel.storedata" data-ng-switch on="dayDataCollapse[$index]">

For level 2, i.e. the second tr

<tr data-ng-switch-when="true">, in which you have the second level ng-repeat.

Check out the fiddle http://jsfiddle.net/Pixic/VGgbq/ for nested accordion like table.

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.