【发布时间】:2018-06-27 14:57:53
【问题描述】:
我正在开发一个模块,我必须重新设计一些产品。以下是之前产品展示方式的截图。
现在产品将显示在其特定名称的手风琴内。我一定会使用 ui.bootstrap 版本:0.11.0 - 2014-05-01。以下是产品现在如何展示的草图。在每个手风琴中,都会有一个特定产品的数据表,其中的列将动态生成,我们将能够检查我们想要的特定产品。
以下是我的html代码:
<accordion>
<accordion-group ng-repeat="AllProduct in AllProducts">
<accordion-heading>
{{AllProduct.TypeName}}
</accordion-heading>
</accordion-group>
<table id="dtVoice" class="table manage-user-table offer-mgt-table" dt-options="dtOptions" dt-columns="dtColumns"></table>
</accordion>
我动态创建数据表的方式如下:
dtColumns.push(DTColumnBuilder.newColumn(null).withTitle('').notSortable()
.renderWith(function(data, type, full, meta) {
return '<input type="checkbox" ng-model="showCase.selected[' + data.id + ']"/>';
}));
for (var key in $scope.VoiceProducts[0]) {
if (key == "ProductName" || key == "LongDistanceMinutes" || key == "IsCallWaiting") {
dtColumns.push(
DTColumnBuilder.newColumn(key).withTitle(key)
)
}
$scope.dtColumns = dtColumns;
$scope.dtOptions = DTOptionsBuilder.newOptions()
.withOption('data', $scope.VoiceProducts)
.withOption('dataSrc', '')
angular.element('#dtVoice').attr('datatable', '')
}
$compile(angular.element('#dtVoice'))($scope);
以下是我的 json
[
{
"ProductList": [
{
"ProductName": "Voice",
"IsActive": false,
"IsDeleted": false,
"LongDistanceMinutes": "",
"IsCallWaiting": "",
"CallWaitingId": "",
"IsThreeWayCalling": "",
"IsCallerId": "",
"IsCallForwarding": "",
"IsCallRejection": "",
"ID": 552,
"OfferId": 0
}
],
"ID": 2,
"IsActive": false,
"IsDeleted": false,
"TypeName": "Voice"
}
]
如何把这个数据表放在手风琴里面?因为无论做什么,我都无法实现。
【问题讨论】:
-
你的问题到底是什么?
-
如何把这个数据表放在手风琴里面?因为无论做什么,我都无法实现。
-
非常感谢,但我需要以 bootrap 手风琴为边界的数据表的动态列来实现它。
-
检查并解释需要做什么codepen.io/anon/pen/rpbzpX
标签: angularjs datatables angular-datatables bootstrap-accordion