Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make new item also draggable? #32

Open
warenix opened this issue May 3, 2019 · 1 comment
Open

How to make new item also draggable? #32

warenix opened this issue May 3, 2019 · 1 comment

Comments

@warenix
Copy link

warenix commented May 3, 2019

Initially I have a table of 4 rows, and I initialized Draggable once.

    Draggable(tableElement, avatarHandler: AvatarHandler.clone());

    Dropzone dropzone = Dropzone(stationListElement);

    dropzone.onDrop.listen((DropzoneEvent event) {
      _reorder(event.draggableElement, event.dropzoneElement);
    });

Later the component added a new row after some user interaction.

Problem is that new row isn't draggable.
I tried initialize again but the drop event is listened twice.

Do you have any suggestion how to handle it on my use case?

@marcojakob
Copy link
Owner

marcojakob commented May 3, 2019

At the moment this use case is not handled very nice. You could try to create a new draggable for each new element but I'm not sure if that will work and if it will not have unwanted side-effects like unnecessary listeners for the same event.

I think it's a valid use case. We could change the structure in draggable.dart and draggable_manager.dart to allow adding new elements. The Draggable could still have an initial list of elements in the constructor but in addition get a new method to later add elements.

If you (or anyone else) wants to have a go at it, I think I could assist and should find time to review a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants