反应网格布局上的draggableCancel

时间:2017-04-03 10:46:29

标签: reactjs react-grid-layout

我正在使用react grid layoutamcharts3-react一切都很好,我可以移动元素但是,这次我不能使用amcarts Zoom手柄......它们也是可拖动的。我尝试使用网格布局的cancelDraggable功能但没有发生任何事情。即使它没有阻止我指定用于非重写的区域。可能的解决方案是什么?

enter image description here



                <GridLayout>
                  <div key="d" data-grid={{x: 4, y: 0, w: 4, h: 2, draggableHandle: '.dragHandle', draggableCancel:'.noneDraggable'}}>
                    <span className="dragHandle">[DRAG HERE]</span>
                    <div className="noneDraggable">
                      <Chart />
                    </div>
                  </div>

                  <div key="c" data-grid={{x: 0, y: 0, w: 4, h: 2}}>
                    <Chart />
                  </div>

                </GridLayout>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:2)

我通过将属性与仪表板本身相关联来解决,而不是像项目一样:

<ResponsiveReactGridLayout 
  rowHeight={75}
  layouts={this.props.dashboard.record.layout} 
  onBreakpointChange={this.onBreakpointChange.bind(this)}
  onDragStop={this.onDragStop.bind(this)}
  draggableCancel='.dashboard-item-content' 
  draggableHandle='.dashboard-item-header'
  onResizeStop={this.onResizeStop.bind(this)}>
    {this.generateDOM()}
</ResponsiveReactGridLayout>

尝试将2个属性与GridLayout jsx节点相关联。