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

Remove elements from dragulaInput target box with custom dragulaOpts #143

Open
f-meister opened this issue Mar 26, 2021 · 0 comments
Open

Comments

@f-meister
Copy link

f-meister commented Mar 26, 2021

Right now, I would like the dragula inputs to have a combination of behaviors for "replace = TRUE" and "replace = FALSE", where if the user selects an element from the source box, it will be copied over. The objective is to have multiple instances the source element in any of the target boxes, and there can be more than 1 item in each target box.

To achieve this, I've tried the following:

    dragulaInput(
      inputId = ns("dragvars"),
      sourceLabel = "Variables",
      targetsLabels = c("X", "Y", "Fill", "Color", "Size", "Group", "Facet", "FacetRow", "FacetCol"),
      targetsIds = c("xvar", "yvar", "fill", "color", "size", "group", "facet", "facet_row", "facet_col"),
      choiceValues = var_choices,
      choiceNames = badgeType(
        col_name = var_choices,
        col_type = col_type(source_data[, var_choices])
      ),
      dragulaOpts = list(copy = TRUE),
      status = "primary",
      badge = FALSE,
      width = "100%",
      height = "70px",
      replace = FALSE
    )

However, this causes the elements in the target boxes to be stuck and cannot be removed from the target box. Another effect it has is duplicating the elements in the source box if the user drags from target box to source box.

Hope you can help with a fix for this.

-Fabian

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

1 participant