Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

draggableCancel on react-grid-layout

I am using react grid layout with amcharts3-react everything is just fine, I can move elements around but, this time I can't use amcarts Zoom handles... They are draggable as well.I tried to use grid layout's cancelDraggable feature but nothing happened. even it didn't prevent the area that I specify for nonedragging. What could be the possible solution?

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>
like image 562
beratuslu Avatar asked Jul 14 '26 10:07

beratuslu


1 Answers

I solved by associating the property to the dashboard itself, not the items, like so:

<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>

Try to associate the 2 properties to your GridLayout jsx node.

like image 81
Francesco Meli Avatar answered Jul 19 '26 06:07

Francesco Meli



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!