javascript - ng-click doesn't work in responsive angular-datatables -
i'm trying click on element of table in responsive way, doesn't work. seems ng-click doesn't work perfectly..
this html table:
<table id="listadifferite" datatable="ng" dt-options="mycontroller.dtoptions" class="table table-bordered table-striped" cellspacing="0" width="100%"> <thead> <tr> <th>col1</th> <th>col2</th> <th>col3</th> <th>col4</th> </tr> </thead> <tbody> <td data-dt-column="{{differite.iddif}}_0" class="text-center">prova</td> <td data-dt-column="{{differite.iddif}}_1" class="text-center"> <a ng-click="controllerdif.mostradettaglio(differite)"><i class="fa fa-search-plus"></i></a> </td> <td data-dt-column="{{differite.iddif}}_2" class="text-center">prova</td> <td data-dt-column="{{differite.iddif}}_3" class="text-center">prova</td> </tr> </tbody> </table>
and dtoptions in mycontroller:
self.dtoptions = dtoptionsbuilder.newoptions() .withpaginationtype('full_numbers') .withoption('responsive', { details: { type: 'column', target: 0 } })
another similar issue here: https://github.com/l-lin/angular-datatables/issues/552
adding function controller fixed :
function renderer(api, rowidx, columns) { var data = $.map( columns, function ( col, ) { return col.hidden ? '<li data-dtr-index="'+col.columnindex+'" data-dt-row="'+col.rowindex+'" data-dt-column="'+col.columnindex+'">'+ '<span class="dtr-title">'+ col.title+ '</span> '+ '<span class="dtr-data">'+ col.data+ '</span>'+ '</li>' : ''; }).join(''); return data ? $compile(angular.element($('<ul data-dtr-index="'+rowidx+'"/>').append( data )))($scope) : false; }
and add responsive option
.withoption('responsive', { details: { renderer: renderer } })
Comments
Post a Comment