From 6e1bd3d9b47ed1bf47c8daaf512ab2e9c3d9b4af Mon Sep 17 00:00:00 2001 From: ccrowhurstram Date: Sat, 15 Aug 2015 16:43:29 +0100 Subject: [PATCH] refactor(filters): move responsibility for adding empty data item into select.html template Adding an empty option to the array returned by `$column.filterData` only makes sense when using that array as the datasource for the `select.hmtl` template. Therefore the responsibility for doing this should be moved into this template. This allows the `$column.filterData` to provide a suitable datasource for custom templates that might not want an empty option. This commit also fixes a problem where `$column.filterData` is used in more than one ngTable. In this scenario duplicate empty items would be added to the array. BREAKING CHANGE: `ngTableController` 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. --- src/ng-table/filters/select.html | 3 ++- src/scripts/ngTableController.js | 13 ------------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/ng-table/filters/select.html b/src/ng-table/filters/select.html index 48250686..ae407b3b 100644 --- a/src/ng-table/filters/select.html +++ b/src/ng-table/filters/select.html @@ -1,4 +1,5 @@ -