donejs-select
Knockoutjs-style select for donejs
http://knockoutjs.com/documentation/options-binding.html
How to use it
- install it in your project
npm install donejs-select --save
- import it in your stache file
<can-import from="donejs-select/" />
- finally insert it including the options, example:
<donejs-select
{(options)}=optionsArrayOfObject
{(selected-element-value)}=yourOwnVariable
debug=true
options-caption="choose an element:"
options-caption-separator=true
options-caption-separator-text="//////////"
options-text="text"
options-value="value"
/>
NOTE: optionsArrayOfObject must be an array of objects
Assume you have:
[{text: "hello", value: 1}, {text: "good bye", value: 999}]
then the select will show "hello" and "good bye" and the selected value will be either 1 or 999
How to test it
Usage
ES6 use
With StealJS, you can import this module directly in a template that is autorendered:
;
CommonJS use
Use require
to load donejs-select
and everything else
needed to create a template that uses donejs-select
:
var plugin = ;
AMD use
Configure the can
and jquery
paths and the donejs-select
package:
Standalone use
Load the global
version of the plugin:
Contributing
Making a Build
To make a build of the distributables into dist/
in the cloned repository run
npm install
node build
Running the tests
Tests can run in the browser by opening a webserver and visiting the test.html
page.
Automated tests that run the tests from the command line in Firefox can be run with
npm test