以下の機能が同じ角度コントローラにあります。角度を使用してjquery datatable行のチェックボックスをバインドする方法
$ scope.init()は、Jqueryデータテーブルを構成するために使用します。最初の列に
Iはチェックボックスがあると私はチェックボックス変更/トグルにtoggleSelection()を呼び出し、オブジェクトIDを渡す必要があります。
しかし、私はそうすることができません。
$scope.init = function {
var testTable = $('#testTable').dataTable($.extend({
aaSorting:[[5, 'desc']],
fnRowCallback: function (nRow, object, iDisplayIndex){
//some code to format rows
},
aoColumns: [{
mData: "id", sTitle: "", bSortable: false,
mRender:function(data, type, question){
return '<input type="checkbox" ng-click="toggleSelection(' + object.id + ')"/>';
}},
//....Other columns
],
fnServerData: TestApiHandler
}, defaultTableSettings))
//TestApiHandler: Already configured for Ajax call
//defaultTableSettings: dafault setting for datatable
}
$scope.toggleSelection = function(id) {
console.log('Object Id' + id)
}
以下は、datatable用のHTMLです。
<table id="testTable" class="table table-bordered table-condensed table-striped table-hover "></table>
これが機能していません。私はまだ$ scope.checkboxesに空の配列を取得しています。 – Vivek