2

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")

        }
3
  • "I tried with ng-change/ng-click both are not working"? Because they are not recognised by Angular. Follow the example more narrow, you miss some rather important parts in the extract above. Commented Jun 30, 2017 at 9:24
  • I have same problem Commented Dec 21, 2017 at 9:14
  • Did you solve the problem? Commented Dec 23, 2017 at 4:51

1 Answer 1

1

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!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.