Angular 数据表:无法调用 destroy/edit 函数
Angular Datatables: cannot call destroy/edit function
我无法访问此 doc, as well as the destroy method described 中提到的 API 方法。
HTML:
<table datatable dt-instance="dtInstance" dt-options="dtOptions" dt-columns="dtColumns" class="table-striped">
</table>
在我的控制器中我有:
a.dtInstance = {};
var getTableData = function() {
var deferred = $q.defer();
deferred.resolve(tablecontent_array);
return deferred.promise;
};
a.dtOptions = DTOptionsBuilder.fromFnPromise( getTableData())
.withPaginationType('full_numbers');
a.dtColumns = [
DTColumnBuilder.newColumn('id').withTitle('ID').notVisible(), //
DTColumnBuilder.newColumn('groupby').withTitle('Group By').notSortable(),
DTColumnBuilder.newColumn('value').withTitle('value').notSortable()
]
'tablecontent_array' contains the data.
当我尝试 modify/destroy table 时出现错误。
a.dtInstance.rerender()
错误信息:
TypeError: a.dtInstance.rerender is not a function
我的目的是在某些用户操作后修改table。 table 数据渲染良好。但是我无法访问它的任何 API 方法。
可能是我在这样做时犯了一些错误,我是 angular-datatable 的新手,关于这个问题的任何 help/suggestions 都会有所帮助。
在思考这个问题几天后,我尝试按照评论中的建议创建 plnkr。事实证明我没有使用正确版本的数据表、Angular 和其他库的主机。更正了那个,问题就解决了。
即便如此,我的 objective 的 adding/appending 个新列也没有以 angular 的方式解析。然而,有些人使用 jquery 数据表发布了可能的解决方案。
我无法访问此 doc, as well as the destroy method described
HTML:
<table datatable dt-instance="dtInstance" dt-options="dtOptions" dt-columns="dtColumns" class="table-striped">
</table>
在我的控制器中我有:
a.dtInstance = {};
var getTableData = function() {
var deferred = $q.defer();
deferred.resolve(tablecontent_array);
return deferred.promise;
};
a.dtOptions = DTOptionsBuilder.fromFnPromise( getTableData())
.withPaginationType('full_numbers');
a.dtColumns = [
DTColumnBuilder.newColumn('id').withTitle('ID').notVisible(), //
DTColumnBuilder.newColumn('groupby').withTitle('Group By').notSortable(),
DTColumnBuilder.newColumn('value').withTitle('value').notSortable()
]
'tablecontent_array' contains the data.
当我尝试 modify/destroy table 时出现错误。
a.dtInstance.rerender()
错误信息:
TypeError: a.dtInstance.rerender is not a function
我的目的是在某些用户操作后修改table。 table 数据渲染良好。但是我无法访问它的任何 API 方法。
可能是我在这样做时犯了一些错误,我是 angular-datatable 的新手,关于这个问题的任何 help/suggestions 都会有所帮助。
在思考这个问题几天后,我尝试按照评论中的建议创建 plnkr。事实证明我没有使用正确版本的数据表、Angular 和其他库的主机。更正了那个,问题就解决了。
即便如此,我的 objective 的 adding/appending 个新列也没有以 angular 的方式解析。然而,有些人使用 jquery 数据表发布了可能的解决方案。