javascript - 带有服务器端分页的角度js数据表标识为空
问题描述
我正在使用带有服务器端分页的角度 js 数据表。我需要检查表是否为空。如果表为空,我需要禁用我的按钮。请检查我的代码
我使用以下函数获取数据。
$scope.loadRequestApproval = function () {
$scope.dtOptions = DTOptionsBuilder.newOptions()
.withOption('ajax', {
dataType: 'json',
contentType: "application/json; charset=utf-8",
url: appConfig.apiUrl + "/finalizedAllList?reqTraceId=" + $scope.requestApprovalId + "&status=PENDING",
xhrFields: { withCredentials: true },
type: 'POST',
data: function (d) {
// console.log(data)
return JSON.stringify(d);
},
error: function (response) {
ajaxErrorHandler.handle(response);
}
})
.withDataProp('data')
.withOption('processing', true)
.withOption('serverSide', true)
.withOption('scrollY', '400px')
.withOption('scrollX', '100%')
.withOption('scrollCollapse', true)
.withOption('searching', true)
.withOption('drawCallback', function (settings) {
});
$scope.dtOptions.withOption('fnRowCallback',
function (nRow, aData, iDisplayIndex, iDisplayIndexFull) {
$compile(nRow, aData, iDisplayIndex, iDisplayIndexFull)($scope);
});
$scope.dtColumns = [
DTColumnBuilder.newColumn('treaceId.traceId').withTitle('Trace ID').notSortable(),
DTColumnBuilder.newColumn('name').withTitle('Name').notSortable(),
DTColumnBuilder.newColumn('matchRatio').withTitle('Match Strength %').notSortable(),
DTColumnBuilder.newColumn('resultId').withTitle('Action').renderWith(function (data, type, full) {
return '<div class="btn-group-xs">' +
' <button type="button" class="btn btn-flat btn-xs btn-success" ng-click="openDetailViewWindow(\'' + full.resultId + '\');" data-toggle="tooltip" data-placement="right" title="View" tooltip>' +
' <i class="ion ion-eye"></i>' +
' </button>' +
'</div>';
}).withClass('text-center').notSortable()
];
};
这是我的带有按钮的 html 页面
<form class="form-horizontal" name="kycapprovalform">
<button ng-disabled="dtColumns"> Approve</button>
<div class="row x-scrollable-table">
<div class="col-sm-12">
<table width="100%" ng-if="dtColumns" id="approval-table" datatable="" dt-options="dtOptions"
dt-columns="dtColumns" class="kyc-table table table-bordered table-hover">
</table>
</div>
</div>
</form>
当数据表为空时,我如何禁用我的批准按钮。非常感谢您的帮助
解决方案
推荐阅读
- maven - 如何在 log4j2 中使用 Log4j 方法
- linux-kernel - 是否可以使用 eBPF 来做到这一点?即,我可以在文件被删除之前捕获事件吗?并收回
- facebook-javascript-sdk - Facebook 应用程序中的 JSSDK 未知主机域
- apache-nifi - 无法将日志从 Apache NiFi 发送到 Graylog
- ios - 如何使用objective-c更改iOS应用程序的语言?
- r - R替换数据框中的多行
- c++ - 决策树 - 从特定节点删除
- java - java.lang.ClassNotFoundException - scala blaze 服务器测试
- postgresql - 将 CSV 文件导入 postgres。错误:没有这样的文件或目录
- static - 如何替换 Hugo 主题的默认主页并定义自定义路由?