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

Action Button loosing it's binding on browser resizing, Please Help #552

Closed
@nitin27may

Description

@nitin27may

Hi @l-lin

I followed the example from angular-datatables advance example Bind Angular Directive and used it together with the Responsive plugin. but it's loosing action filed's Binding.

I have follow all comments from the issue #324 but no luck,

image

it's working fine in full screen.

image

Here is the Code:

'use strict';
angular.module('showcase.withResponsive', ['datatables'])
.controller('WithResponsiveCtrl', WithResponsiveCtrl);

function WithResponsiveCtrl($scope, $compile,DTOptionsBuilder, DTColumnBuilder) {
var edit = function() {
alert('edit!');
};

var deleteRow = function() {
    alert('delte!');
};
var actionsHtml = function (data, type, full, meta) {
return '<button class="btn btn-warning" ng-click="edit()">' +
    '   <i class="fa fa-edit"></i>' +
    '</button>&nbsp;' +
    '<button class="btn btn-danger" ng-click="deleteRow()">' +
    '   <i class="fa fa-trash-o"></i>' +
    '</button>';
};
 var createdRow = function (row, data, dataIndex) { 
    $compile(angular.element(row).contents())($scope);
};

$scope.edit = edit;
$scope.deleteRow = deleteRow;
$scope.message = '';
$scope.dtInstance = {};


$scope.dtOptions = DTOptionsBuilder.fromSource('http://127.0.0.1:1771/data.json')
    .withPaginationType('full_numbers')
.withOption('createdRow', createdRow)
    .withOption('responsive', true);
$scope.dtColumns = [
    DTColumnBuilder.newColumn('id').withTitle('ID'),
    DTColumnBuilder.newColumn('firstName').withTitle('First name'),
    DTColumnBuilder.newColumn('lastName').withTitle('Last name'),
    DTColumnBuilder.newColumn(null).withTitle('Actions').notSortable().renderWith(actionsHtml)
];

}

Table HTML

                           <table datatable="" dt-options="dtOptions" dt-columns="dtColumns" dt-instance="dtInstance" class="row-border hover" width="100%"></table>

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions