Skip to content

Commit

Permalink
Add default, update docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpschaaf committed Aug 8, 2015
1 parent 15d63ef commit ca267a5
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions src/lib/template/array-selector.html
Expand Up @@ -77,6 +77,17 @@
observer: '_resetSelection'
},

/**
* When `true`, multiple items may be selected at once (in this case,
* `selected` is an array of currently selected items). When `false`,
* only one item may be selected at a time.
*/
multi: {
type: Boolean,
value: false,
observer: '_resetSelection'
},

/**
* When `multi` is true, this is an array that contains any selected.
* When `multi` is false, this is the currently selected item, or `null`
Expand All @@ -94,16 +105,6 @@
toggle: {
type: Boolean,
value: false
},

/**
* When `true`, multiple items may be selected at once (in this case,
* `selected` is an array of currently selected items). When `false`,
* only one item may be selected at a time.
*/
multi: {
type: Boolean,
observer: '_resetSelection'
}
},

Expand All @@ -128,6 +129,13 @@
}
},

/**
* Returns whether the item is currently selected.
*
* @method isSelected
* @param {*} item Item from `items` array to test
* @return {boolean} Whether the item is selected
*/
isSelected: function(item) {
if (this.multi) {
return this._selectedColl.getKey(item) !== undefined;
Expand All @@ -138,6 +146,9 @@

/**
* Deselects the given item if it is already selected.
*
* @method isSelected
* @param {*} item Item from `items` array to deselect
*/
deselect: function(item) {
if (this.multi) {
Expand All @@ -156,6 +167,9 @@
/**
* Selects the given item. When `toggle` is true, this will automatically
* deselect the item if already selected.
*
* @method isSelected
* @param {*} item Item from `items` array to select
*/
select: function(item) {
var icol = Polymer.Collection.get(this.items);
Expand Down

0 comments on commit ca267a5

Please sign in to comment.