expand and collapse row for ng-table

3,884 views
Skip to first unread message

denny john

unread,
Mar 27, 2015, 3:17:38 AM3/27/15
to ang...@googlegroups.com

I am trying to achieve an expand and collapse row for ng-table, basically what we want is if you click on row it expands with more detail. Does anyone know how to achieve this?

Any help appreciated thanks


this is the the plunkr : http://plnkr.co/edit/xvAC9D6Do6rOkot1KwF4?p=preview

Sander Elias

unread,
Mar 27, 2015, 8:43:29 AM3/27/15
to ang...@googlegroups.com

Hi Denny,

You have a small mistake in your template, you are closing the ‘end-TR’ on the wrong place.
Put something like this in:

                <tr ng-repeat-start="user in $data">
                    <td ng-repeat="column in columns" ng-show="column.visible" sortable="column.field" style="text-align:center;">
                        {{user[column.field]}}
                    </td>
                    <td>
                        <button ng-if="user.expanded" ng-click="user.expanded = false">-</button>
                        <button ng-if="!user.expanded" ng-click="user.expanded = true">+</button>
                    </td>
                </tr>
                <tr ng-if="user.expanded" ng-repeat-end>
                    <td colspan="8">test</td>
                </tr>

Regards
Sander

DENNY JOHN

unread,
Mar 29, 2015, 7:47:27 AM3/29/15
to ang...@googlegroups.com
thanku Sander.It worked :) 

--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/eBgQAM8ZSIA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages