donejs-select

1.1.1 • Public • Published

donejs-select

Knockoutjs-style select for donejs

Build Status

http://knockoutjs.com/documentation/options-binding.html

How to use it

  1. install it in your project npm install donejs-select --save
  2. import it in your stache file <can-import from="donejs-select/" />
  3. 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

  1. npm test
  2. or http://localhost:8100/test/test.html
  3. or http://localhost:8100/src/donejs-select.html

Usage

ES6 use

With StealJS, you can import this module directly in a template that is autorendered:

import plugin from 'donejs-select';

CommonJS use

Use require to load donejs-select and everything else needed to create a template that uses donejs-select:

var plugin = require("donejs-select");

AMD use

Configure the can and jquery paths and the donejs-select package:

<script src="require.js"></script>
<script>
    require.config({
        paths: {
            "jquery": "node_modules/jquery/dist/jquery",
            "can": "node_modules/canjs/dist/amd/can"
        },
        packages: [{
             name: 'donejs-select',
             location: 'node_modules/donejs-select/dist/amd',
             main: 'lib/donejs-select'
        }]
    });
    require(["main-amd"], function(){});
</script> 

Standalone use

Load the global version of the plugin:

<script src='./node_modules/donejs-select/dist/global/donejs-select.js'></script>

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.1
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.1.1
    1
  • 1.1.0
    2
  • 1.0.0
    1
  • 0.0.0
    1

Package Sidebar

Install

npm i donejs-select

Weekly Downloads

5

Version

1.1.1

License

none

Last publish

Collaborators

  • nicoriesco