Reputation: 129
I am trying to use http://l-lin.github.io/angular-datatables/archives/#!/rowSelect I am unable to call "toggleAll","toggleOne". I am not able to find out where I am doing wrong?
I tried with ng-change/ng-click both are not working?
can any one help me.
var vm=this;
var initModel = function fnInitModel() {
var titleHtml = '<input type="checkbox" ng-model="$ctrl.selectAll" ng-change="$ctrl.toggleAll($ctrl.selectAll, $ctrl.checkedSymbol)">';
var data = vm.data;
vm.dtOptions = DTOptionsBuilder.newOptions()
.withOption('data', data);
vm.dtColumns = [
DTColumnBuilder.newColumn(null).withTitle(titleHtml).notSortable()
.renderWith(function(data, type, full, meta) {
vm.checkedSymbol = false;
return '<input type="checkbox" ng-model="$ctrl.checkedSymbol" ng-click="$ctrl.toggleOne($ctrl.checkedSymbol)">';
}),
DTColumnBuilder.newColumn('symbolName').withTitle('Symbol Name'),
DTColumnBuilder.newColumn('lastPrice').withTitle('Last Price'),
];
};
vm.$onInit = function fnInit() {
initModel();
};
vm.$onChanges = function fnOnChanges() {
initModel();
};
vm.toggleAll = function toggleAll (selectAll, selectedItems) {
console.log("toggleAll Called")
}
vm.toggleOne = function toggleOne (selectedItems) {
console.log("toggleOne Called")
}
Upvotes: 2
Views: 2122
Reputation: 15
I think you're missing the next option.
.withOption('createdRow', function(row, data, dataIndex) {
// Recompiling so we can bind Angular directive to the DT
$compile(angular.element(row).contents())($scope);
})
the documentation says it!
Upvotes: 1