From 36db55f6620d428eee8e4c4a29c42396db3cd4d2 Mon Sep 17 00:00:00 2001 From: Legend Tang Date: Fri, 6 Mar 2015 03:45:58 +0800 Subject: Replace `addListener` method with multiple bindings, fix for #503 504 --- web/src/js/components/flowtable.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'web/src/js') diff --git a/web/src/js/components/flowtable.js b/web/src/js/components/flowtable.js index d4515257..76c865e2 100644 --- a/web/src/js/components/flowtable.js +++ b/web/src/js/components/flowtable.js @@ -65,15 +65,24 @@ var FlowTable = React.createClass({ }, componentWillMount: function () { if (this.props.view) { - this.props.view.addListener("add update remove recalculate", this.onChange); + this.props.view.addListener("add", this.onChange); + this.props.view.addListener("update", this.onChange); + this.props.view.addListener("remove", this.onChange); + this.props.view.addListener("recalculate", this.onChange); } }, componentWillReceiveProps: function (nextProps) { if (nextProps.view !== this.props.view) { if (this.props.view) { - this.props.view.removeListener("add update remove recalculate"); + this.props.view.removeListener("add"); + this.props.view.removeListener("update"); + this.props.view.removeListener("remove"); + this.props.view.removeListener("recalculate"); } - nextProps.view.addListener("add update remove recalculate", this.onChange); + nextProps.props.view.addListener("add", this.onChange); + nextProps.props.view.addListener("update", this.onChange); + nextProps.props.view.addListener("remove", this.onChange); + nextProps.props.view.addListener("recalculate", this.onChange); } }, getDefaultProps: function () { -- cgit v1.2.3