Results 1 to 2 of 2

Thread: Extending drag drop functionality for copying records

  1. #1

    Default Extending drag drop functionality for copying records

    Hi,

    Can we extend drag and drop functionality for copying records when the view has only 1 store?
    We have implemented drag and drop functionality for moving records using the DragDrop plugin. But according to the documentation this can be used for enabling copy of records if they belong to different stores. But in our case we have only 1 store. Is it possible to achieve copying of records by drag/drop in this case?

    https://docs.sencha.com/extjs/6.5.1/...#cfg-allowCopy

    Thanks,
    Sonakshi

  2. #2
    Sencha User
    Join Date
    Apr 2016
    Posts
    12
    Answers
    1

    Default

    You can. You just need to create a new instance of the model and then you just insert it to the store.

    So this is what you do:
    1. some copy/allowCopy/some_key should be set on your dragData that indicates that you want to copy
    2. override handleNodeDrop of your dropZone; as far as I remember this method is responsible for handling the drops in both grid and tree (you can look this up yourself) and has a crossView check. So if the target and origin views are the same (crossView == false), then it repositions, doesn't copy.
    3. of course you don't want the above, so if the crossView is false && copy is true, you create a new record, something like store.createModel(data) or just clone the record in one way or another.
    4. Then you just insert it to the store at the drop position

    I hope this helps.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •