Skip to content
This repository was archived by the owner on Feb 2, 2025. It is now read-only.

Row click conflict with buttons for actions #692

Closed
nikitpatel24 opened this issue Apr 18, 2016 · 3 comments
Closed

Row click conflict with buttons for actions #692

nikitpatel24 opened this issue Apr 18, 2016 · 3 comments
Labels

Comments

@nikitpatel24
Copy link

nikitpatel24 commented Apr 18, 2016

When i click on row, the button click does not work.

Is there a way tohave both a row click and a edit click

  var vm = this;
    vm.users = [];
    vm.dtOptions = DTOptionsBuilder.newOptions()
.withPaginationType('full_numbers')
.withDisplayLength(10)
.withBootstrap()
.withOption('rowCallback', rowCallback);
     vm.dtColumnDefs = [
       DTColumnBuilder.newColumn('id').withTitle('ID'),
          DTColumnBuilder.newColumn('firstName').withTitle('First name'),
          DTColumnBuilder.newColumn('lastName').withTitle('Last name').notVisible(),
          DTColumnBuilder.newColumn(null).withTitle('Actions').notSortable()
              .renderWith(function(data, type, full, meta) {
                  return '<button class="btn btn-warning" ng-click="edit(' + data.id + ')">' +
                      '   <i class="fa fa-edit"></i>' +
                      '</button>&nbsp;' +
                      '<button class="btn btn-danger" ng-click="delete(' + data.id + ')">' +
                      '   <i class="fa fa-trash-o"></i>' +
                      '</button>';
              })
      ];`
@l-lin
Copy link
Owner

l-lin commented May 2, 2016

If you are using the ControllerAs syntax, the you need to specify your controller name in the renderWith function.
For example, if your controller name is showCase, then you need to specify it:

.renderWith(function(data, type, full, meta) {
                  return '<button class="btn btn-warning" ng-click="showCase.edit(' + data.id + ')">' +
                      '   <i class="fa fa-edit"></i>' +
                      '</button>&nbsp;' +
                      '<button class="btn btn-danger" ng-click="showCase.delete(' + data.id + ')">' +
                      '   <i class="fa fa-trash-o"></i>' +
                      '</button>';
              })

@zygimantus
Copy link

The ng-click does not work. Can you give full example?

@l-lin
Copy link
Owner

l-lin commented May 14, 2017

@zygimantus, you need to use the createdRow to compile with AngularJS.
See this example.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants