Author Topic: Drag n Drop: function to evaluate drop rows  (Read 27 times)

mikep

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 2
    • View Profile
Drag n Drop: function to evaluate drop rows
« on: September 13, 2019, 01:05:34 am »
I need to disallow rows from being dropped into my main grid, based on conditions in the source grid column. If the 1st column in the dropped row from the source grid is not checked, I don't want the row added.

How would I update the below function to do this.


                drop: function (evt, uiDrop) {



                    //only add if the source column is checked
                    this.addNodes([node], isNaN(rowIndx) ? null : rowIndx);
                }


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 4038
    • View Profile
Re: Drag n Drop: function to evaluate drop rows
« Reply #1 on: September 13, 2019, 12:22:46 pm »
There is no need to override dropModel.drop callback.

dragModel.isDraggable and dropModel.isDroppable callbacks can be used to set up conditional rules for selective drag & drop of rows.

https://paramquery.com/pro/api#option-dragModel

mikep

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Drag n Drop: function to evaluate drop rows
« Reply #2 on: September 13, 2019, 05:04:26 pm »
Thanks, that helps. Are there any examples demonstrating this, that I can work from?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 4038
    • View Profile
Re: Drag n Drop: function to evaluate drop rows
« Reply #3 on: September 13, 2019, 06:32:54 pm »
This example demonstrates usage of dragModel.isDraggable and dropModel.isDroppable callbacks

https://paramquery.com/pro/demos/dnd_tree