The order of events firing has changed.
Previously the datasetChanged
event would fire after the afterCreated
event. Now afterCreated
event will fires first.
A css class specified using the header-class will now be added to the filter row header cell and not
just the sorting row.
If you want to continue to apply the css rules only to the cell in the sorting header row you
will now need to qualify your css rule with the '.header' css class.
So the following:
.my-customer-header {
/* rules */
}
... will need to change to:
.header.my-customer-header {
/* rules */
}
A context object combines and replaces the $scope
and locals
argument originally supplied to$column
getter functions.
This context object prototypically inherits from the original $scope
and has the fields from the
original locals
argument as own properties.
It change is very unlikely to affect you
ngTableColumn.buildColumn
now expects a third parameter - a reference to the $columns
array that will contain the column being built
NgTableParams.settings().data
renamed to NgTableParams.settings().dataset
Previously:
var tp = new NgTableParams({}, {data: yourArray });
Now:
var tp = new NgTableParams({}, {dataset: yourArray });
Move settings().filterDelay
to settings().filterOptions.filterDelay
settings().groupBy
renamed and moved to parameters().group
Previously:
var params = new NgTableParams({...}, { groupBy: 'role'});
// changing value:
params.settings({ groupBy: 'age'});
Now:
var params = new NgTableParams({group: 'role'}, {...});
// changing value:
params.group('age');
// OR
params.parameters({ group: { age: undefined }});
This means that groups will no longer be duplicated and split across pages.
All parameter values are now URI encoded, thus a numerical filter value will now be returned as a quoted string
$
filter field changesthis
context of the filter function to the current NgTableParamsngTableController
no longer adds an empty item to the array returned by $column.filterData
.
This will only affect those apps that were using $column.filterData
to supply data to a custom
filter template.
Those apps that are using the select.html
will be unaffected as the select.html
filter will add
this empty item.
An empty item - { id: '', title: '' }
- is added to an array returned synchronously by filterData
function.
Implications:
* make sure to not add an empty option yourself as this will be a duplicate
* your array of items need to have an id
and title
field so as to match the empty option
Default page size has been increased from 1 to 10.
To override this behaviour set the default page size in the a run block:
angular.module("yourApp").run(setRunPhaseDefaults);
setRunPhaseDefaults.$inject = ["ngTableDefaults"];
function setRunPhaseDefaults(ngTableDefaults) {
ngTableDefaults.params.count = 1;
}
NgTableParams
no longer exposes a getGroups
method.
getGroups
is now a method on the settings object only.
NgTableParams
no longer exposes a getData
method
The column
parameter of the getGroups
method has been removed.
Instead the groupBy
value on the NgTableParams.settings()
object supplied as a parameter will
be used to determine the grouping.
Previously:
var groupsFetched = tableParams.settings().getGroups('age');
Now:
tableParams.settings({ groupBy: 'age'});
var groupsFetched = tableParams.settings().getGroups(tableParams);
The sortBy function previously declared by ngTableController
has been moved to the new controller
- ngTableSorterRowController
.
Calls to NgTableParams.filter
, NgTableParams.sorting
(etc) made in the then
method of
the promise returned by NgTableParams.reload
will NOT trigger a subsequent call to NgTableParams.reload
;
the call to NgTableParams.reload
must now be explicitly be made.
Previously:
tableParams.reload().then(function(){
if (!tableParams.total() && _.size(tableParams.filter()) > 0) {
tableParams.filter({});
}
});
Now:
tableParams.reload().then(function(){
if (!tableParams.total() && _.size(tableParams.filter()) > 0) {
tableParams.filter({});
return tableParams.reload();
}
});
Previously:
<tr>
<td ng-show="showColExpr">
</tr>
Now:
<tr>
<td ng-if="showColExpr">
</tr>
Previously:
cols[1].position = 2;
cols[2].position = 1;
Now:
var swappedCol = cols[2];
cols[2] = cols[1];
cols[1] = swappedCol;
thead>th
attributes that reference the current column will need modifyingPreviously:html <td title="getTitle(column)">
Now:
html <td title="getTitle($column)">
- directive: due to 3113e340,
This will affect you only if you are enumerating / specifically checking for "own properties" of the column object.
- filters:
- due to c2f83b98,
Custom header.html templates will need to pass the current scope as a parameter to column.filter.
Previously:
<!-- snip -->
<div ng-repeat="(name, filter) in column.filter">
<!-- snip -->
... now becomes:
<!-- snip -->
<div ng-repeat="(name, filter) in column.filter(this)">
<!-- snip -->
Previously:
<td filter="{'username': 'text', $$name: 'username'}"</td>
... now becomes:
<td filter="{'username': 'text'}"</td>
Previously:
<input type="text" name="{{column.filterName}}"
... now becomes:
<input type="text" name="{{name}}"
Multiple filters defined by the same filter definition will now render each input with a seperate name.
filters:
Previously:
<tr class="ng-table-filters" ng-init="tableParams">
<th ng-repeat="column in columns" ng-show="column.visible" class="filter">
<div ng-repeat="(name, filter) in column.filter">
<div ng-if="column.filterTemplateURL" ng-show="column.filterTemplateURL">
<div ng-include="column.filterTemplateURL"></div>
</div>
<div ng-if="!column.filterTemplateURL" ng-show="!column.filterTemplateURL">
<div ng-include="'ng-table/filters/' + filter + '.html'"></div>
</div>
</div>
</th>
</tr>
... now becomes:
<tr class="ng-table-filters" ng-init="tableParams">
<th ng-repeat="column in columns" ng-show="column.visible" class="filter">
<div ng-repeat="(name, filter) in column.filter">
<div ng-if="filter.indexOf('/') !== -1" ng-include="filter"></div>
<div ng-if="filter.indexOf('/') === -1" ng-include="'ng-table/filters/' + filter + '.html'"></div>
</div>
</th>
</tr>
Previously:
<td filter="{ 'name': 'text', templateURL: 'path/to/textFilter.html'}"</td>
... now becomes:
<td filter="{ 'name': 'path/to/textFilter.html'}"</td>
Previously:
<td filter="{
'fname': 'text',
'lname': 'text',
templateURL: 'path/to/textFilter.html'}"</td>
... now becomes:
<td filter="{
'fname': 'path/to/textFilter.html',
'lname': 'path/to/textFilter.html'}"</td>
parse method on the ngTable scope has been removed as it's no longer required
Previously, a css class was added to TH elements thusly:
<tr ng-repeat="row in $data">
<td header-class="myHeaderClass"></td>
</tr>
Now:
<tr ng-repeat="row in $data">
<td header-class="'myHeaderClass'"></td>
</tr>
header-class
attributedata
field to ngTableParamsIn functions that return data for the filters were removed .promise
javascript $scope.names = function(column) { ... def.resolve(names); // return def.promise; - old code return def; };