ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: npdev13 on August 01, 2019, 03:13:55 pm

Title: Drag & Drop issue in the Tree Grid
Post by: npdev13 on August 01, 2019, 03:13:55 pm
Hello,

I am using Pro version and in that using Tree grid, I have restrict tree for 3 level only. (Root > Section > Question)

My requirement is like that Section can not be inside section. I have restricted by writing some validation Drop event and it is working correctly.
But what other issue is suppose I have 3 sections and each have some items as shown in the attached screenshot, and I want to drag 3rd section to at first but when I drag and Drop it at top of Section 1 it move in to Section 1. but it is wrong I need to put it at top.

Can you please tell me  what setting required so it not put one section insdie other section while Drag & Drop and fulfill my requirement?

Thanks.

Title: Re: Drag & Drop issue in the Tree Grid
Post by: paramvir on August 01, 2019, 04:30:31 pm
When section 3 is dragged and dropped onto Root, it's supposed to be a child of Root as per default implementation of dropModel.drop event.

If you have implemented your own dropModel.drop event, could you please share a jsfiddle / plnkr so that I can look into it.
Title: Re: Drag & Drop issue in the Tree Grid
Post by: npdev13 on August 01, 2019, 05:03:53 pm
Hi I have put one condition drop event to restrict one child item move to other parent.

denyDrop = (
                                rdDrop == rdDrag ||
                                rdDrop.pq_gsummary ||
                                Tree.isAncestor(rdDrop, rdDrag) ||
                                rdDrag.parentId != rdDrop.parentId
                            );
 

Attached is the fiddle.

http://jsfiddle.net/sg0v43zp/


Thanks,
Title: Re: Drag & Drop issue in the Tree Grid
Post by: paramvir on August 01, 2019, 08:25:24 pm
Thanks for sharing jsfiddle. Looking into it.
Title: Re: Drag & Drop issue in the Tree Grid
Post by: paramvir on August 01, 2019, 09:28:24 pm
your requirement is to prevent drop of a section into another section (and its children) so it should be (rdDrag.pq_level == 1 && rdDrop.pq_level >=1) in denyDrop.

Code: [Select]
                            denyDrop = (
                                rdDrop == rdDrag ||
                                rdDrop.pq_gsummary ||
                                Tree.isAncestor(rdDrop, rdDrag) ||
                                (rdDrag.pq_level == 1 && rdDrop.pq_level >=1)
                            );                     

http://jsfiddle.net/rf7nptyj/2/
Title: Re: Drag & Drop issue in the Tree Grid
Post by: npdev13 on August 02, 2019, 10:00:21 am
Hi

Thanks yes it solve partial problem, but main thing how I can move the order of other section which not want to put at top?
For example Section 3 want to move just at top of Section 2. so it display like Section 1 then Section 3 and Section 2

Thanks,
Title: Re: Drag & Drop issue in the Tree Grid
Post by: paramvir on August 02, 2019, 10:04:26 am
Quote
For example Section 3 want to move just at top of Section 2. so it display like Section 1 then Section 3 and Section 2

For that you drag the Section 2 and drop it on upper half of root node ( Testing Desc )
It would reorder as Section 1 then Section 3 and Section 2

http://jsfiddle.net/g4mvLcrw/