我有以下设计
function crudDataTable()
{
this.addEditFormContainerSelector = '';
this.paginationType = "full_numbers"; // Provide Pagination Type
this.processing = true;
this.serverSide = true; //I want this this to be accessible in fnRowCallback below:
this.create = function(){
this.tableInstance = $(this.tableLocationSelector).DataTable({
"sPaginationType": this.paginationType
fnRowCallback:function(nRow, aData) {
// "this" from crudDataTable should be accessible here
}
})
}
}
我希望this
fromcrudDataTable
可以在fnRowCallback
.
我怎样才能做到这一点?,也是fnRowCallback
由datatable
组件触发的,所以这不在我的控制范围内。如何this
在fnRowCallback
.
或者,如果这是不可能的,那么实现它的其他方法是什么?
我正在尝试编写一个组件,这些组件的用户可以简单地设置其变量并调用 create 函数。我正面临着this
在fnRowCallback
函数中访问的挑战。
谢谢。