angular-datatables icon indicating copy to clipboard operation
angular-datatables copied to clipboard

how to generate serial number 1,2,3,etc.. using datatable anuglarjs?

Open Coderwill opened this issue 9 years ago • 2 comments

I am create small demo for listing user list using datatable angularjs.user list working very well in demo.now i want to generate serial number 1 to n..in table 1 to 100 records is store then want to serial number 1 to 100.

here i am done with this code:

app.controller("userscontroller", ["$scope", "$http", "DTOptionsBuilder", "DTColumnBuilder", "userservice","$compile"
function ($scope, $http, DTOptionsBuilder, DTColumnBuilder, userservic,$compile) {       

    $scope.dtColumns = [            
        DTColumnBuilder.newColumn("fullName", "Full Name").withOption('name', 'firstname'),
        DTColumnBuilder.newColumn("username", "Name").withOption('name', 'username'),
        DTColumnBuilder.newColumn("email", "Email").withOption('name', 'email'), 
        DTColumnBuilder.newColumn(null).withTitle('Action').withOption('defaultContent', ' ').notSortable()
            .renderWith(function (data, type, full, meta) {
                if (data.UserCount > 1)
                    return '<button class="btn btn-primary" ng-click="delete(' + data.id + ');"><i class="fa fa-eye"></i>' + '</button>';                    
            })          
    ]

    $scope.dtOptions = userservice.GetAllUser(DTOptionsBuilder)
    .withOption('processing', true)
    .withOption('serverSide', true)
    .withPaginationType('full_numbers')
    .withDisplayLength(50)
    .withOption('aaSorting', [3, 'desc'])

     function createdRow(row, data, dataIndex) {
        $compile(angular.element(row).contents())($scope);
    }
}]);

here is my html code:

<table id="tbluserlist" datatable="" dt-options="dtOptions" dt-columns="dtColumns" dt-instance="dtInstance" class="table table-hover"> </table>

Coderwill avatar Mar 24 '17 12:03 Coderwill

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 06 '20 14:12 stale[bot]

This issue has been closed due to inactivity. Please feel free to re-open the issue to add new inputs.

stale[bot] avatar Dec 13 '20 14:12 stale[bot]