简体   繁体   中英

AngularJS ng-show on colgroup tag

Building a table where the user can choose to hide some columns (month - or the indiviual series for that each month). Is it possible to use ng-show with a colgroup or col tag - so I don't need to add the ngshow to every cell? Can't seem to get it working...

<colgroup ng-repeat="mth in months" span="2" ng-show="mth.checked">
    <col  ng-show="headerOptions[0].selected" />
    <col  ng-show="headerOptions[1].selected" />
</colgroup>

This has little to do with AngularJS and more to do with HTML/CSS.

Hiding columns in a HTML table is pain. There are some questions with answers here on SO already. Take a look at Hide/Show Column in an HTML Table and How to hide columns in HTML table? .

A performance tip could be to hide the entire table before hiding/showing the columns to avoid unnecessary reflow/repaint events.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM