Skip to content

csv-export plugin: custom data watcher #854

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 3, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions plugins/README.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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);
}
};
}