angularjs ajax datatable,Cannot reinitialise DataTable - AngularJS with datatable

When I combine AngularJS (1.6.x) with jQuery data-tables, I get alert error:

Cannot reinitialise DataTable

First I use AngularJS to bind and fill data-tables,

then I try to add Individual column searching (text inputs) feature.

AngularJS initialize data-tables, but does not give me a handle.

Here is my code:

var app1=angular.module('formvalid', ['ui.bootstrap','ui.utils']);

app1.controller('validationCtrl',function($scope){

angular.element(document).ready(function () {

// Setup - add a text input to each footer cell

$('#example tfoot th').each( function () {

var title = $(this).text();

$(this).html( '' );

} );

console.log(' document ready function, add search by column feature ');

var table = $('#example').DataTable();

// Apply the search

table.columns().every( function () {

var that = this;

$( 'input', this.footer() ).on( 'keyup change', function () {

if ( that.search() !== this.value ) {

that

.search( this.value )

.draw();

}

} );

} );

});// document ready

$scope.data=[[

"Tiger Nixon",

"System Architect",

"Edinburgh",

"5421",

"2011\/04\/25",

"$320,800"

]];

$scope.dataTableOpt = {

//custom datatable options

// or load data through ajax call also

// "data": $scope.data00, // this is not real binding, the real binding is ui-jq="dataTable" ui-options="dataTableOpt", fill $scope.data

"aLengthMenu": [[10, 50, 100,-1], [10, 50, 100,'All']],

};

});

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值