Giter Club home page Giter Club logo

Comments (5)

aleemb avatar aleemb commented on August 17, 2024

Second that. Same problem has me stumped.

Any pointers would be very welcome.

from rivets.

mikeric avatar mikeric commented on August 17, 2024

select-multiple inputs now work with the standard data-value binding in 0.3.10. Values should always be an array in this case — when the input changes, it will set the attribute with the array of selected values. Likewise, setting the attribute value to an array of selected values will update the select-multiple input's options accordingly.

from rivets.

aleemb avatar aleemb commented on August 17, 2024

In the general use case most select boxes are (id, name) tuples where the ID is almost always a number.

Rivets.js expects to find a string so the following check fails where value is [1,2] and _ref is "1":

_results.push(o.selected = (_ref = o.value, __indexOf.call(value, _ref) >= 0));

It's better to check for bot strings and numbers (note: +_ref converts string to number):

_results.push(o.selected = (_ref = o.value, __indexOf.call(value, _ref) >= 0 || __indexOf.call(value, +_ref) >= 0));

I thought about converting IDs to a string array on the server side before passing it on to the client but that wouldn't be right since the JSON model representation wouldn't truly reflect the model. Since in HTML all attributes are considered strings whether you quote them or not, the model-view binder should handle it.

For now I have made the above change in my rivetsjs hoping it gets patched. If the patch doesn't get accepted, should I be looking to make the change in the adapter?

from rivets.

aleemb avatar aleemb commented on August 17, 2024

Formatters are great! Just discovered their use through your other posting and will be using those in the interim.

from rivets.

Tibar avatar Tibar commented on August 17, 2024

I know this post is old but how can I set a select to be a select-multiple and rivets recognizes that?

<select data-rv-value="building_vent.value" multiple="multiple" size="5" type="select-multiple">

That doesnt work ...

from rivets.

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.