Javascript 在AngularJS上导出datatables只显示表头
我正在集成到AngularJS应用程序中 一切看起来都很好(分页、列排序、导出按钮),但当我尝试打印/复制/导出表时,它只输出标题,即使其他数据都在那里 数据从$http调用加载:Javascript 在AngularJS上导出datatables只显示表头,javascript,angularjs,datatable,Javascript,Angularjs,Datatable,我正在集成到AngularJS应用程序中 一切看起来都很好(分页、列排序、导出按钮),但当我尝试打印/复制/导出表时,它只输出标题,即使其他数据都在那里 数据从$http调用加载: $http({ method: 'GET', url: $rootScope.apiURL+'getAllClientProducts/'+session, headers: {'Content-Type': 'application/x-www-form-urlencoded'} }).su
$http({
method: 'GET',
url: $rootScope.apiURL+'getAllClientProducts/'+session,
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
}).success(function(response){
if(response.ErrorMessage === null && response.Result !== null){
$scope.products = Object.keys(response.Result).map(function (key) {return response.Result[key]});
}
})
.error(function(data){
alert('Something went wrong. Please try again.');
});
以下是我的表格选项:
$scope.dtOptions = DTOptionsBuilder.fromSource('data.json')
.withDOM('frtip')
.withPaginationType('full_numbers')
// Active Buttons extension
.withButtons([
'copy',
'print',
'excel'
]);
这是我的表格的HTML:
<table class="table table-striped table-bordered table-hover" datatable="ng" dt-options="dtOptions">
<thead>
<tr>
<th st-sort="Name">{{ 'NAME' | translate }}</th>
<th st-sort="Description">{{ 'DESCRIPTION' | translate }}</th>
<th st-sort="Barcode">{{ 'BAR_CODE' | translate }}</th>
<th st-sort="InternalCode">{{ 'INTERNAL_CODE' | translate }}</th>
<th st-sort="SaleUnitType">{{ 'SALE_UNIT_TYPE' | translate }}</th>
<th st-sort="UnitMeasure">{{ 'MEASURE_UNIT' | translate }}</th>
<th st-sort="Status">{{ 'STATUS' | translate }}</th>
<th>{{ 'ACTIONS' | translate }}</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="product in products">
<td>{{ product.Name }}</td>
<td>{{ product.Description }}</td>
<td>{{ product.Barcode }}</td>
<td>{{ product.InternalCode }}</td>
<td>{{ product.SaleUnitType }}</td>
<td>{{ product.UnitMeasure }}</td>
<td>{{ product.Status }}</td>
<td>
<a class="btn btn-primary btn-xs" ng-click="edit(product.InvProductId)"><i class="fa fa-edit"></i> {{'EDIT' | translate}}</a>
</td>
</tr>
</tbody>
</table>
{{‘名称’|翻译}
{{‘描述’|翻译}
{{‘条形码’|翻译}
{{‘内部代码’|翻译}
{{'SALE_UNIT_TYPE'{124; translate}}
{{‘度量单位}翻译}
{{“状态”|翻译}
{{‘动作’|翻译}
{{product.Name}
{{product.Description}}
{{product.Barcode}}
{{product.InternalCode}
{{product.SaleUnitType}
{{product.UnitMeasure}
{{product.Status}
{{'EDIT'| translate}}
我做错什么了吗?提前谢谢。您解决过这个问题吗,我遇到了这个问题