Angularjs jQuery datatables add processing event
Angularjs jQuery datatables add processing event
我使用 Angular 数据表模块。 https://github.com/l-lin/angular-datatables
我尝试添加processing.dt
事件,但它不起作用。
这是来自基本 API 的原始代码https://datatables.net/reference/event/processing
$('#example')
.on( 'processing.dt', function ( e, settings, processing ) {
$('#processingIndicator').css( 'display', processing ? 'block' : 'none' );
} )
.dataTable();
这是我未完成的代码
.withOption('processing.dt', function( e, settings, processing){
console.log(processing);
$scope.loading = processing;
}) .withOption('initComplete', function(){
$scope.loading = false;
})
在处理角度数据表时,使用 dataTables 事件没有区别。如果您有表格
<table datatable dt-options="dtOptions" dt-columns="dtColumns" id="example">
那么这有效 [ http://plnkr.co/edit/hBDjR9ytD0hK6YgwrgMd?p=preview ]
$('#example').on('processing.dt', function() {
console.log('processiong.dt');
})
这有效 [ http://plnkr.co/edit/zKYyrneXl2YudNTXZkXv?p=preview ]
angular.element('#example').on('processing.dt', function() {
console.log('processiong.dt');
})
如果您使用dtInstance
您甚至可以将事件侦听器附加到该dtInstance
(此处等待初始化,然后附加一个order.dt
处理程序 [ http://plnkr.co/edit/DJa1xwzxArrWhplDY278?p=preview ](:
$scope.dtInstance = {}
$scope.$watch('dtInstance', function() {
if ($scope.dtInstance.DataTable) {
$scope.dtInstance.DataTable.on('order.dt', function() {
console.log('order.dt')
})
}
})
只是为了证明没有特定的"角度数据表"处理事件的方式,它基本上是完全相同的 - 你只有更多的选择,因为你也有angular.element()
的方式,可以处理特殊的dtInstance
对象。
相关文章:
- issue with FB.Event.subscribe
- Angularjs :$routeChangeStart event
- event.prventDefault()持续多久
- <text区域>在我的html中包含event.keycode==13之后,wrap就不起作用了
- KeyDown event for CKeditor
- Javascript events: window.event vs argument reference (funct
- 动态填充Bootstrap选择选择器:change event dos'不起作用
- <td> focusin event .addclass
- event.preventDefault阻止ajax调用
- google.maps.event.addDomListener(window, 'load', fun
- jQuery event.target is_a_child_of(element)
- event.stopPropagation()在firefox javascript中不起作用
- asp.net text onkeyup event
- 如何从ondragend获取正确的event.pageX
- 面料:“;鼠标:向下”;在event.target中未返回对象
- 使用event.target.classlist区分按钮颜色
- event.keycode vs event.which
- 将字符串作为参数传递给函数onclick event jquery
- iFrame onload JavaScript event
- Angularjs jQuery datatables add processing event