Ho scritto una direttiva dataTables per AngularJS. Funziona bene, tranne che sto cercando di aggiungere un pulsante alla riga che rimuove una riga con un ng-clic.ng-click non funzionante AngularJS e dataTables
A mio parere è che il problema si verifica perché la riga della tabella non ora l'ambito.
Qualcuno può aiutarmi a risolvere questo problema.
jsFiddle Esempio: http://jsfiddle.net/A5Zvh/7/
mia direttiva simile a questa.
angular.module('DataTables', [])
.directive('datatable', function() {
return {
restrict: 'E',
transclude: true,
replace: true,
require: 'ngModel',
template: '<table></table>',
link: function(scope, element, attrs, model) {
var dataTable = null,
options;
var buttons = jQuery.parseJSON(attrs['buttons']) || null;
options = {
"bJQueryUI": false,
"sDom": "<'row-fluid'<'span4'l><'span8 filter' <'pull-right'T> <'pull-right'f>>r>t<'row-fluid'<'span6'i><'span6'p>>",
"sPaginationType": "bootstrap",
"oTableTools": {
}
};
if(_.has(attrs, 'datatableOptions')) {
jQuery.extend(true, options, scope.$eval(attrs['datatableOptions']));
}
scope.$watch(attrs.ngModel, function(data) {
if(data && _.size(data.aaData) > 0 && _.size(data.aoColumns) > 0) {
_.extend(options, scope.$eval(attrs.ngModel))
dataTable = $(element).dataTable(options);
dataTable.fnClearTable();
dataTable.fnAddData(data.aaData);
}
});
}
}
})
jsFiddle per favore. – SunnyShah
@SunnyShah done;) – user1266573
Nessun organismo ha un'idea su come risolvere questo problema? – user1266573