angular-datatables - 列的renderWith函数可以从promise中返回值吗?

时间:2015-05-15 03:36:32

标签: javascript angularjs datatables promise jquery-datatables

是否可以调用从列的renderWith()函数中返回promise的服务/过滤器?我正在尝试这样做,输出始终是“[object Object]”。

vm.dtInstance = {};

vm.dtOptions = DTOptionsBuilder.fromFnPromise(MyService.getData())
            .withPaginationType('full_numbers')
            .withOption('rowCallback', casesDtRowCallback)
            .withBootstrap()
            .withOption('createdRow', createdRow)
            .withOption('scrollX', true)
            .withOption('scrollY', false);

vm.dtColumns = [
            DTColumnBuilder.newColumn(null)
                .withTitle('ID')
                .renderWith(idHtml),
            DTColumnBuilder.newColumn(null)
                .withTitle('Status')
                .renderWith(statusHtml),
];

function caseStatusHtml(data, type, full, meta) {
            return $filter('myCustomFilter')(data.theStatus).then(function(response) {
                // myCustomFilter returns a string
                return response;
            })
}

0 个答案:

没有答案