search

Home  >  Q&A  >  body text

angular.js - When ng-grid is used with tabset, the grid width is very small by default.

Using ui-bootstrap’s tabset and ng-grid to create the following effect.

After the tab is switched to the second label, the grid displayed by default is as shown below. The automatically generated width is only 100px, which is obviously wrong (⊙o⊙)

Everyone who has used ng-grid must have encountered this problem, please give me the answer! The little girl is helpless! Woohoo~~~~(>_<)~~~~

曾经蜡笔没有小新曾经蜡笔没有小新2775 days ago686

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-05-15 16:51:22

    Solved it by trick

        <ul class="nav nav-tabs">
            <li ng-class="active">
                <a ng-click="showGrid=true;active='active';active2=''">表格1</a>
            </li>
            <li ng-class="active2">
                <a ng-click="showGrid=false;active='';active2='active'">表格2</a>
            </li>
        </ul>
        <p ng-if="showGrid" class="gridStyle" ng-grid="gridOptions"></p>
        <p ng-if="!showGrid" class="gridStyle" ng-grid="gridOptions2"></p>
    

    reply
    0
  • Cancelreply