Code Monkey home page Code Monkey logo

Comments (4)

fcFn avatar fcFn commented on September 18, 2024 3

You need to set the attribute on multi listbox like this <paper-listbox multi selected-values="[1, 2]">. This is described in the list of paper-listbox properties.

Also see #19.

from paper-listbox.

codekrolik avatar codekrolik commented on September 18, 2024

This is an example of how hard and hacky it gets without the feature (Dart):

    //...userList was loaded from server via REST

    //clear listbox items
    PolymerDom listboxDom = Polymer.dom(userMultiChoice);
    for (Node childNode in listboxDom.childNodes)
      listboxDom.removeChild(childNode);

    //recreate listbox items
    List<int> selectedItems = new List<int>();
    for (int i = 0; i < userList.length; i++) {
      User user = userList[i];

      for (String username in selectedUsernames) {//~~~~
        if (username == user.username) {
          selectedItems.add(i);
          break;
        }
      }

      PaperItem item = new PaperItem();
      item.text = user.username;
      listboxDom.append(item);
    }

    //apply selection
    for (int item in selectedItems) {
      userMultiChoice.select(item);
    }

from paper-listbox.

kylefarris avatar kylefarris commented on September 18, 2024

This issue can probably be closed since @fcFn has clearly stated the answer...

from paper-listbox.

yglodt avatar yglodt commented on September 18, 2024

I have tried using paper-listbox multi selected-values="[1, 2]", and for it it only worked if the numbers are provided as String: ["1","2"]

Note that I use attr-for-selected="value" with <paper-item value="0">AAA</paper-item> etc

from paper-listbox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.