Coder Social home page Coder Social logo

Comments (5)

solkimicreb avatar solkimicreb commented on July 22, 2024

Thats right multi select is not yet implemented. Data binding uses HTMLSelectElement.value for the binding - which is the first selected value in case of a multi select (according to the spec).

I guess shelly should be an array of the selected values, in your case. It needs to be reworked a bit to support this. I would ask if you are interested in submitting a PR, but currently setting up the project locally is pretty painful because of the modular nature (lots of repos) 😄. I plan to make things more community and PR friendly for the next release and i will squeeze in a fix for this too.

Thx for the issue, I will keep it open until the fix arrives!

from bind-middleware.

solkimicreb avatar solkimicreb commented on July 22, 2024

This works as a one way binding in the meantime, if that's enough for your use case:

const map = Array.prototype.map  
nx.components.app()
	.use((comp, state) => {
		state.names = ['John', 'Ann', 'Joe']
		state.onchange = (ev) => {
			state.selected = map.call(ev.target.selectedOptions, option => option.value).join(', ')
		}
	}).register('my-app')
<my-app>
  <select name="selected" multiple #change="onchange($event)">
    <option value='John'>John</option>
    <option value='Ann'>Ann</option>
    <option value='Joe'>Joe</option>
  </select>
	<p>@{selected}</p>
</my-app>

from bind-middleware.

solkimicreb avatar solkimicreb commented on July 22, 2024

@jaypha I fixed it: nx-js/bindable-middleware@f3bb59f.

Now your example would set selly to an array of values. Just run an npm i to get the latest version (1.0.2) of the bindable middleware. I will wait to see if it works for you before closing this (:

from bind-middleware.

jaypha avatar jaypha commented on July 22, 2024

I just tested the new fix, and this appears to work fine. Thanks.

from bind-middleware.

solkimicreb avatar solkimicreb commented on July 22, 2024

Great! I am closing this issue then.

from bind-middleware.

Related Issues (2)

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.