We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Drag drop problems

Hi

Two more problems in TreeGrid drag&drop. 
Check test scenario and drag element3 to child of element2 and then right click element1.
-Element3 is "dragged to child of element1" and when debuggin I think reason is that _insertAsChild is never returned to false, also even if drag&drop is left click only up is still handled also with right click (but of course you know better your underhood...).
-When element3 is dragged under element1 its parentId is updated and childMapping too even if I have not mapping it. The record element (example ejTreeGrid.model.flatRecords[0]) contains childMapping from the initialization (which is fine) but after drag&drop its will be updated to actual item too (which is wrong I think). At least part of problem appear in _recordLevel(). This causes problems example in case: https://www.syncfusion.com/forums/119997/data-refresh-bug (and deepcopy is not of course solving this) but of course having unexcepted data appearing to datamodel have several potential problems on user side.

Attachment: drag_to_child_4d88aef0.zip

5 Replies

MK Mahalakshmi Karthikeyan Syncfusion Team September 3, 2015 12:11 PM UTC

 Hi Niko,

Sorry for the inconvenience caused.

Query1: -Element3 is "dragged to child of element1" and when debugging I think reason is that _insertAsChild is never returned to false, also even if drag & drop is left click only up is still handled also with right click (but of course you know better your under hood...).

Solution: We were able to reproduce the reported issue and logged an issue report regarding this. A support incident has been created under your account to track the status of this requirement. Please log on to our support website for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents

Please let us know if you have any other query.

Query2: When element3 is dragged under element1 its parentId is updated and childMapping too even if I have not mapping it.

Solution: The childMapping record is updated only at the load of TreeGrid widget, but after a row drag and drop we update only the ‘childRecords’ of the parent record, whereas ‘childMapping’ is not updated for any row drag and drop. So we recommend you to use the childRecords in the record collection to track the child records in that parent item instead of “childMapping”.

Regards,

Mahalakshmi K.



NA Niko Autio September 4, 2015 08:31 AM UTC

I have done some more tests now and I can say that there is inconsistent functionality.
"..but after a row drag and drop we _update_only_ the ‘childRecords’ of the parent record..." - no its much more random.

Ok first it seems that these are working:
model.flatRecords has right order
model.parentRecords works too
record.parentItem contains right item
record.childItems works too

To make it short and clear I use word "record" for example model.flatRecords[0] and word "item" model.flatRecords[0].item

But with mapped information things are going messy. All scenarios are single step from initialization, do not combine them!
First ID mapped scenario (uses same file like in first post)
Initialization:
 "" child array is inside record, not in item (element1 of course)

drag element2 under elment3 (so 3 elements in root)
Id mapping of element1 is updated correctly to item (parentId is deleted) but idmapping of record is not
element1 record still has "" array which still include element2 but this item is not updated (its a copy)

drag element2 to child of element3
element2 parentID updated again correctly to item but not to record (like last time)
"" child array appear to element3, its empty in record but include correctly element2 in item

drag element3 to child of element1
element3 parentID updated in item but not in record like before
element1 record "" child array is not updating and no "" array still in item

derag element2 to child of element3 and then element1 to child of element3
element3 record "" child array is not updating but item "" array is updating

Child mapped scenarios (actions equal to last), children = childMapped array (demo file is attached)
Initialization:
everything ok

drag element2 under elment3 (so 3 elements in root)
children array of element1 updating correnctly in record and item

drag element2 to child of element3
element1 children array is updating in both correclty like in last 
children array of element3 updating only updates only to item, not in record

drag element3 to child of element1
element1 children array of element1 updates correclty in record and in item

derag element2 to child of element3 and then element1 to child of element3
children array of element3 updates to item but not in records
Conclusions
Child mapping
Record.Item.children contains always right data, it works
Record.children is updated always witch detach child and add child IF target parent had children at initialization (WAT?)
Also I noticed inconsistent that if there is no children, sometimes children array is completely deleted and sometimes its just empty (even if it wasn't exist at initialization)
ID mapping
Record.parentId is never updating
Record.item.parentId is always updating correclty
If item has "" childArray it will be always updated correclty
Record "" childArray is never updating
Item "" childarray is appearing situateion when you drag element to child of another WHICH DON'T HAVE record "" child array -> in another words: when first children is added with drag
Also here I think there was inconsistent does parentId setted to null or deleted
What should be changed / fixed in my opinion:
Record.children (childmapping) should be updated or not but no random behaviour
"" childarray (id mapping) should be inside item and keep on updating in every scenario or not appear at all (which is best in case where childmappin is not actual  in use)
Not so important: It would be nice that parentId is always null or undefined and children array empty or undefined but not changing randomly

Attachment: drag_to_child_deep_b8c407c2.zip


NA Niko Autio September 4, 2015 08:37 AM UTC

Typos / unclear sentences

Record.children is updated always when detaching child. If target parent had children at initialization add works too (WAT?)
...
Item "" childarray is appearing in situations where you drag element to child of another element WHICH DON'T HAVE record "" child array -> in another words: when first children is added with drag


NA Niko Autio September 4, 2015 10:56 AM UTC

Unlike I tested in that limited test scenario record.item.parentId is some random cases undefined even if it have a parent.


MK Mahalakshmi Karthikeyan Syncfusion Team September 7, 2015 12:27 PM UTC

Hi Niko,

Sorry about the inconvenience caused.

We were able to reproduce the issues reported by you. We have also logged an issue report and working on this issue with high priority. A support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents

Please let us know if you require further assistance on this.      

Regards,

Mahalakshmi K.


Loader.
Live Chat Icon For mobile
Up arrow icon