Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/366.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 将AngularJS ui网格与表一起使用_Javascript_Html_Angularjs_Angular Ui Grid - Fatal编程技术网

Javascript 将AngularJS ui网格与表一起使用

Javascript 将AngularJS ui网格与表一起使用,javascript,html,angularjs,angular-ui-grid,Javascript,Html,Angularjs,Angular Ui Grid,我在应用程序中使用AngularJS ui网格。我有一些表格,例如有50-100行,没关系。现在我想使用ui.grid.autoresize模块,该模块将自动调整网格(表)的大小,而无需滚动 我正在这里使用帮助 我试图将ui网格属性放在table标记中,也放在div标记中。。。但它现在起作用了 您可以在下面查看我的示例 控制器视图 <div class="panel> <div class="panel-heading">{{someheading}}</d

我在应用程序中使用AngularJS ui网格。我有一些表格,例如有50-100行,没关系。现在我想使用ui.grid.autoresize模块,该模块将自动调整网格(表)的大小,而无需滚动

我正在这里使用帮助
我试图将ui网格属性放在table标记中,也放在div标记中。。。但它现在起作用了

您可以在下面查看我的示例

控制器视图

<div class="panel>
    <div class="panel-heading">{{someheading}}</div>
    <div class="panel-body">
        <table ui-grid="gridData" ui-grid-auto-resize ng-style="getHeightTable()">
            <thed>
               <tr>
                  <th>{{filename}}</th>
               </tr> 
            </thead>
            <tbody>
                <tr ng-repeat="file in uploadFiles">
                    <td>{{file.fileName}}</td>
                    <td>....</td>
                </tr>
            </tbody>
        </table>
    </div>
</div>
试试这个

angular.module('app',['ui_grid','ui.grid.autoResize']).controller('MainController',[$scope,uiGridConstants]){
    $scope.gridData = {
       roweight : 30,
       data:[]
     };

     //I am populating data with uploaded files
     $scope.gridData.data = $scope.uploadedFiles;
     var rowHeight = 30;
     var headerHeight = 30;
     var height = $scope.gridData.data.length * rowHeight + headerHeight + "px"
     $('.grid').css('height',height + ' !important');
}
并将类添加到表中

<table ui-grid="gridData" ui-grid-auto-resize class="grid">

hey@Kandarp使用此代码,当我启动应用程序时,我的表正在调整大小,就像在无ednless循环中一样。。。。我想在什么时候添加要调整大小的文件,然后。。。随着每个文件的添加。。。
<table ui-grid="gridData" ui-grid-auto-resize class="grid">