Skip to content

Commit

Permalink
Merge pull request #854 from zacronos/custom_data_watcher
Browse files Browse the repository at this point in the history
csv-export plugin: custom data watcher
  • Loading branch information
roblarsen committed Dec 3, 2013
2 parents 769f15d + 1db8552 commit 0367ef7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions plugins/README.md
Expand Up @@ -34,8 +34,10 @@ Add CSV Export to your ng-grid tables by including it in your plugins array:
Options
-------

opts =
{ columnOverrides: < hash of column override functions > }
opts = {
columnOverrides: < hash of column override functions >
customDataWatcher: < function whose return value can be $watched to detect changed data >
}

For arrays and objects you may want to override the default `JSON.stringify`
conversion into strings.
Expand Down
6 changes: 5 additions & 1 deletion plugins/ng-grid-csv-export.js
Expand Up @@ -71,6 +71,10 @@ function ngGridCsvExportPlugin (opts) {
}
return hash;
};
scope.$watch('catHashKeys()', showDs);
if (opts.customDataWatcher) {
scope.$watch(opts.customDataWatcher, showDs);
} else {
scope.$watch(scope.catHashKeys, showDs);
}
};
}

0 comments on commit 0367ef7

Please sign in to comment.