Releases: l-lin/angular-datatables
v0.5.0
This release contains the following:
- Removing the
DTInstances.getLast()
andDTInstances.getList()
as they are deprecated #315 - Add MIT licence in
bower.json
#317 - Update examples:
- add the
$elem
in the parameter of_redrawRows
#321 - Destroy the child scope when data is refreshed in the "Angular way" #326
- Add support for commonjs #332
- Correct the usage of
DTDefaultOptions.setLanguageSource
with the Angular renderer #356 - Add support for Light column filter #431
- Throw an error if the option
serverSide
is set totrue
and the table is not renderer by the Ajax renderer - Avoid exception when using multiple datatables with the Angular renderer #310
v0.4.3
This release contains the following:
- Correct docs #264 #274
- Enable regexp to find ngRepeat comment in multiple lines #252
- Add plugins files to bower.json #260
- Correct
reloadData()
#266 - Add parameter [callback, resetPaging] when reloading data from Ajax source #273
- Correctly display the "processing" div with Bootstrap #281
- Correctly display the sort icons when combining Bootstrap and Scroller plugins #280
- Some attempts to improve the
DTInstances
service #282 #284 - Add an option to reset or note the paging when reloading or changing the data with the Promise renderer #306
vm.dtOptions = DTOptionsBuilder.newOptions().withOption('redraw', false);
- Add the possibility to provide an object or a callback function to fetch the DT instance #307
- The
DTInstances
service will be removed in the v0.5.0+. Use this approach instead:
- The
<div ng-controller="ShowCaseCtrl as showCase">
<table datatable
dt-options="showCase.dtOptions"
dt-instance="showCase.dtInstance">
</table>
</div>
angular.controller('ShowCaseCtrl ', ShowCaseCtrl );
function ShowCaseCtrl(DTOptionsBuilder) {
var vm = this;
vm.dtInstance = {}; // This will be set automatically with the two-way data binding
vm.dtOptions = DTOptionsBuilder.fromSource('data.json');
}
The user also have the possibility to set a callback function instead of a variable:
<div ng-controller="ShowCaseCtrl as showCase">
<table datatable
dt-options="showCase.dtOptions"
dt-instance="showCase.dtInstanceCallback">
</table>
</div>
angular.controller('ShowCaseCtrl ', ShowCaseCtrl );
function ShowCaseCtrl(DTOptionsBuilder) {
var vm = this;
vm.dtInstances = [];
vm.dtOptions = DTOptionsBuilder.fromSource('data.json');
vm.dtInstanceCallback = dtInstanceCallback;
function dtInstanceCallback(dtInstance) {
vm.dtInstances.push(dtInstance);
}
}
v0.4.2
v0.4.1
v0.4.0
Lots of changes in this release! ✨
- The message
event:loadedDT
is no longer emitted. Instead, there is a new serviceDTInstances
that provides the list of the DataTables that are instanciated #174.
You can fetch the instances like this:
DTInstances.getLast().then(function(lastDTInstance) {
// lastDTInstance === {"id": "foobar2", "DataTable": oTable, "dataTable": $oTable, "reloadData": fnReloadData, "changeData": fnChangeData}
// loadedDT.DataTable is the DataTable API instance
// loadedDT.dataTable is the jQuery Object
// See http://datatables.net/manual/api#Accessing-the-API
});
DTInstances.getList().then(function(dtInstances) {
/*
* dtInstances === {
* "foobar": {"id": "foobar2", "DataTable": oTable, "dataTable": $oTable, "reloadData": fnReloadData, "changeData": fnChangeData},
* "foobar2": {"id": "foobar2", "DataTable": oTable, "dataTable": $oTable, "reloadData": fnReloadData, "changeData": fnChangeData}
* }
*/
});
The clumsy API dtOptions.reload()
has been moved to the directive instance. Indeed, reloading data should not be on the options of the DT. It should rather be within the method of the instance of the directive.
Now, to reload the data, you will have to do it like this:
DTInstances.getLast().then(function(dtInstance) {
dtInstance.reloadData();
});
- Expose method to change the data:
angular.module('myModule', ['datatables']).controller('MyCtrl', MyCtrl);
function MyCtrl($resource, DTInstances) {
DTInstances.getLast().then(function(dtInstance) {
// For Ajax renderers
dtInstance.changeData('data.json');
// For Promise renderers
dtInstance.changeData(function() {
return $resource('data.json').query().$promise;
});
});
}
- Expose method to rerender the entire directive #157
DTInstances.getLast().then(function (dtInstance) {
dtInstance.rerender();
});
- Separate the plugins in different dist files #160
For example, if you need to add DataTables ColVis plugin support, then you will need to add the file angular-datatables/dist/plugins/colvis/angular-datatables.colvis.min.js
and your Angular needs to add a dependency to datatables.colvis
along with datatables
.
v0.3.1
This release contains the following:
- Add the possibility to override the Bootstrap pagination container CSS classes #135
vm.dtOptions = DTOptionsBuilder
.fromSource('data.json')
// Add Bootstrap compatibility
.withBootstrap()
.withBootstrapOptions({
pagination: {
classes: {
ul: 'pagination pagination-sm'
}
}
});
- Integration with ColumnFilter plugin #94
vm.dtOptions = DTOptionsBuilder.fromSource('data.json')
.withPaginationType('full_numbers')
.withColumnFilter({
aoColumns: [{
type: 'number'
}, {
type: 'text',
bRegex: true,
bSmart: true
}, {
type: 'select',
values: ['Yoda', 'Titi', 'Kyle', 'Bar', 'Whateveryournameis']
}]
});
- Remove unecessary
$timeout
#146 - Improve Angular digest performance by allowing watching table definitions shallowly #144
- The
angular-datatables
uses deep search for changes on every$digest
cycle. Meaning every time any Angular event happens (ng-clicks, etc.), the entire array, each of it's children, it's children's children, and so forth gets compared to a cached copy. - There is an attribute to add so that if the directive has a truthy value for
dt-disable-deep-watchers
at compile time then it will use$watchCollection(...)
instead. This would allow users to prevent big datasets from thrashing Angular's$digest
cycle at their own discretion.
- The
<table datatable dt-options="showCase.dtOptions"
dt-columns="showCase.dtColumns"
dt-disable-deep-watchers="true"
class="row-border hover">
</table>
- Some updates on documentation
- Some refactoring to follow John Papa's Angular styleguide
- Integration with angular-translate #99
vm.dtColumns = [
DTColumnBuilder.newColumn('id', $translate('id')),
DTColumnBuilder.newColumn('firstName').withTitle($translate('firstName')),
DTColumnBuilder.newColumn('lastName').withTitle($translate('lastName'))
];
- Correction on Scroller plugin that no longer worked #147
v0.3.0
This release contains the following:
- Add the possibility to use AjaxDataProp for promises #111
$scope.dtOptions = DTOptions.fromFnPromise(function() {
return $resource('data.json').query().$promise;
})
.withDataProp('data');
- Loading DT options with a promise #113
$scope.dtOptions = $resource('/angular-datatables/dtOptions.json').get().$promise;
$scope.dtColumns = $resource('/angular-datatables/dtColumns.json').query().$promise;
v0.2.1
This release contains the following:
- Various updates in the documentation
- Correction on ID on the emitting message
- Expose the dataTable and DataTable instances #86:
$scope.$on('event:dataTableLoaded', function(event, loadedDT) {
// loadedDT === {"id": "foobar", "DataTable": oTable, "dataTable": $oTable}
// loadedDT.DataTable is the DataTable API instance
// loadedDT.dataTable is the jQuery Object
// See http://datatables.net/manual/api#Accessing-the-API
});
v0.2.0
This release contains the following:
- Correction on service names (no more
$
prefixes). So you must now callDTDefaultOptions
instead of$DTDefaultOptions
- DataTables v.1.9.7 is no longer supported
- The directive
ngRows
is removed. - Various updates on documentation
v0.1.1
This release contains the following:
- Expose the DataTable object in the event #64:
$scope.$on('event:dataTableLoaded', function(event, loadedDT) {
// loadedDT === {"id": "foobar", dt: oTable}
});