Skip to content

Commit

Permalink
Added optional customExport function to FeatureGrid (#1284)
Browse files Browse the repository at this point in the history
* Added optional customExport function to FeatureGrid

* Code Improve
  • Loading branch information
kappu72 authored and mbarto committed Nov 17, 2016
1 parent 6234225 commit 3b9bc2a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions web/client/components/data/featuregrid/FeatureGrid.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ const FeatureGrid = React.createClass({
dataSource: React.PropTypes.object,
selectAll: React.PropTypes.func,
selectAllActive: React.PropTypes.bool,
zoomToFeatureAction: React.PropTypes.func
zoomToFeatureAction: React.PropTypes.func,
exportAction: React.PropTypes.func
},
contextTypes: {
messages: React.PropTypes.object
Expand Down Expand Up @@ -83,7 +84,12 @@ const FeatureGrid = React.createClass({
selectAll: true
},
dataSource: null,
selectAllActive: false
selectAllActive: false,
exportAction: (api) => {
if ( api) {
api.exportDataAsCsv();
}
}
};
},
shouldComponentUpdate(nextProps) {
Expand Down Expand Up @@ -129,7 +135,7 @@ const FeatureGrid = React.createClass({
}

if (this.props.toolbar.exporter) {
tools.push(<button key="exporter" onClick={() => {this.api.exportDataAsCsv(); }}>
tools.push(<button key="exporter" onClick={() => this.props.exportAction(this.api)}>
<I18N.Message msgId={"featuregrid.export"}/>
</button>);
}
Expand Down

0 comments on commit 3b9bc2a

Please sign in to comment.