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 the rule data dispaly in selected, it's very confusing ? #100

Open
ducvu91 opened this issue Oct 13, 2023 · 1 comment
Open

How the rule data dispaly in selected, it's very confusing ? #100

ducvu91 opened this issue Oct 13, 2023 · 1 comment

Comments

@ducvu91
Copy link

ducvu91 commented Oct 13, 2023

i realy realy can't understant how the rule display in selected. let use demo https://maykinmedia.github.io/dual-listbox/

  1. add One, selected : One
  2. add Two, selected : Two, One
  3. add Three, selected : Three, One, Two => :(
    It also happend with drag, i can't drag to position i wish.
    But in here, it ok. https://preview.keenthemes.com/metronic/demo9/features/miscellaneous/dual-listbox.html
    How to do it like this demo of metronic ?
    thanks a lot
@ROGERIO-RIOS
Copy link

This is not in the example code
dlb2.addEventListener("added", function (event) {
document.querySelector(".changed-element").innerHTML =
event.addedElement.outerHTML;
});
dlb2.addEventListener("removed", function (event) {
document.querySelector(".changed-element").innerHTML =
event.removedElement.outerHTML;
});

This one, maybe it will help you. I'm also having the problem of reading all the selected items on the right.

  let selectedItems = [ ];
    dlb2.addEventListener('added', function(event){
    console.log(event);
    console.log(event.addedElement);
    let addedElement = event.addedElement;
    let itemValue = addedElement.dataset.id;
    selectedItems.push(itemValue);
    console.log('Itens :', selectedItems);
    });

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