2017-03-24 5 views
0

私はAg GridとReactを使用しています。これはAg Gridのマスターディテール機能です。Javascript ES6は、2つの拡張クラス間でパラメータを渡します。

私は、同じfunctionTestが呼び出される2つのクラスがあるとします。

class children extends (Parent,React.Component){ 
      constructor(value){ 
      super(test); 
      this.functionTest= this.functionTest.bind(this); 
      } 

      functionTest(){ 
      return super.functionTest(); 
      } 

      render(){ 
      <AgGridReact 
      ... 
        onGridReady={this.onTestFunction.bind(this)} 
      ... 
      /> 
      } 

    class MyApp extends React.Component { 
    constructor(test) { 
      super(); 
      this.test=test; 
      } 

      functionTest(){ 
      return this.test; 
      } 

      render() { 
      <AgGridReact 
      ... 
        onGridReady={this.functionTest.bind(this)} 
        fullWidthCellRendererFramework= {children} 
      ... 
      /> 
      } 

私はonGridReady小道具を経由してMyAppからfunctionTestに呼び出すことでいくつかの成功を持っていますが、childrenから開始することができない場合。また、私はそれを動作させるためにchildrenに関数を書き直したいのですが、それは冗長になります(私は多くの同様の関数を持っています)。

また、ParentとReact.Componentの子を2重に拡張してもエラーはないようです。

私の質問は、MyAppの中にいる子供たちからfunctionTestを呼び出す方法です。

答えて

0
void calculate(Person p){ 
    p.getCalculableValue(); 
} 
関連する問題