Skip to content

Commit b1a67bf

Browse files
authored
Feature/pre select item on load (#11)
* - updating to v0.4.0 * - allowing pre-selection of individual item onload -Adding 'preSelectItem' config property. - Checking 'preSelectAll' property before pre-selecting individual item. - Adding favicon for example html - updating the Readme.md. - updating example app.js. - adding .gitignore file. * -removing node_modules from repo.
1 parent b87b229 commit b1a67bf

File tree

7,785 files changed

+328
-970104
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

7,785 files changed

+328
-970104
lines changed

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# OS generated files #
2+
######################
3+
.DS_Store
4+
.DS_Store?
5+
._*
6+
.Spotlight-V100
7+
.Trashes
8+
ehthumbs.db
9+
Thumbs.db
10+
11+
# node_modules
12+
/node_modules
13+
14+
/src/assets/temp

README.md

Lines changed: 92 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -126,18 +126,24 @@ Controller:
126126
```
127127

128128
<h3>Set through config in Controller:</h3>
129+
129130
Configure the options from the controller to set <code>dropdown-config</code> attribute.
131+
130132
<p><em>NOTE: </em> When <code>dropdown-config</code> is being used, it will overwrite <code>dropdown-options</code> and <code>dropdown-trackby</code> attribute, if in use. Therefore, it's better to use just one at a time.</p>
133+
131134
<p>Available <code>config</code> options:
132135
<pre>
133136
options,
134137
trackBy,
135-
displayBy,
138+
displayBy,
136139
divider,
137140
icon,
138141
displayBadge,
139142
height,
140-
filter
143+
filter,
144+
multiSelect,
145+
preSelectItem,
146+
preSelectAll
141147
</pre>
142148

143149
Controller:
@@ -166,7 +172,9 @@ $scope.config = {
166172
displayBadge: true,
167173
height: '200px',
168174
filter: true,
169-
multiSelect: false
175+
multiSelect: false,
176+
preSelectItem: true,
177+
preSelectAll: false
170178
};
171179
```
172180

@@ -175,15 +183,87 @@ HTML:
175183
```html
176184
<dropdown-multiselect dropdown-config="config" ></dropdown-multiselect>
177185
```
178-
<h6>options:</h6> <p>Data to be displayed in dropdown list. This should be an array of objects.</p>
179-
<h6>trackBy:</h6> <p>Any property name from the option object that should be used for tracking the selected item.</p>
180-
<h6>displayBy:</h6><p>An array that takes two values which will be used as data to be displayed in dropdown list, in a respective order. If it is not set, then it will automagically set the first two prooperty names as the values to be displayed.</p>
181-
<h6>divider:</h6> <p>A custom divider sign setter <code>-, : , =, # ,......</code> between the dropdown list columns. Default is <code>-</code>.</p>
182-
<h6>icon:</h6> <p>A custom icon setter for the selected items. Works with Font-Awesome too. Default is Bootstrap's glyphicons checkmark.</p>
183-
<h6>displayBadge:</h6> <p>Badge on the dropdown button that displays the total number of selected items from the dropdown list. Default visibility is <code>true</code>, but could be set to <code>false</code>.</p>
184-
<h6>height:</h6> <p>Height of the scrollable item list in a dropdown-box, in pixel. Default height is set to <code>200px</code>.</p>
185-
<h6>filter:</h6> <p>Filter/search items from the dropdown list. Default visibility is <code>false</code>, but could be set to <code>true</code>.</p>
186-
<h6>multiSelect:</h6> <p>Turn multi-select list items "on" or "off". Default is <code>true</code>, but could be turned "off" by setting <code>false</code>.</p>
186+
<h4>options:</h4>
187+
<p>Data to be displayed in dropdown list. This should be an array of objects.</p>
188+
189+
<h4>trackBy:</h4>
190+
<p>Any property name from the option object that should be used for tracking the selected item.</p>
191+
192+
<h4>displayBy:</h4>
193+
<p>An array that takes two values which will be used as data to be displayed in dropdown list, in a respective order. If it is not set, then it will automagically set the first two prooperty names as the values to be displayed.</p>
194+
195+
<h4>divider:</h4>
196+
<p>A custom divider sign setter <code>-, : , =, # ,......</code> between the dropdown list columns. Default is <code>-</code>.</p>
197+
198+
<h4>icon:</h4>
199+
<p>A custom icon setter for the selected items. Works with Font-Awesome too. Default is Bootstrap's glyphicons checkmark.</p>
200+
201+
<h4>displayBadge:</h4>
202+
<p>Badge on the dropdown button that displays the total number of selected items from the dropdown list. Default visibility is <code>true</code>, but could be set to <code>false</code>.</p>
203+
204+
<h4>height:</h4>
205+
<p>Height of the scrollable item list in a dropdown-box, in pixel. Default height is set to <code>200px</code>.</p>
206+
207+
<h4>filter:</h4>
208+
<p>Filter/search items from the dropdown list. Default visibility is <code>false</code>, but could be set to <code>true</code>.</p>
209+
210+
<h4>multiSelect:</h4>
211+
<p>Turn multi-select list items "on" or "off". Default is <code>true</code>, but could be turned "off" by setting <code>false</code>.</p>
212+
213+
<h4>preSelectItem:</h4>
214+
<p>Allow pre-selecting of selected list items on load. Just add in <code>preSelectItem: true</code> config option property, alonng with passing <code>selected: true</code> property to the object that needs to be pre-selected while setting up the config options.</p>
215+
216+
```javascript
217+
var options = [ {
218+
'Id': 1,
219+
'Name': 'Batman',
220+
'Costume': 'Black',
221+
'selected': true // this will pre-select this option
222+
}, {
223+
'Id': 2,
224+
'Name': 'Superman',
225+
'Costume': 'Red & Blue'
226+
}, {
227+
'Id': 3,
228+
'Name': 'Hulk',
229+
'Costume': 'Green'
230+
}];
231+
232+
$scope.config = {
233+
options: options,
234+
trackBy: 'Id',
235+
displayBy: [ 'Name', 'Costume' ],
236+
divider: ':',
237+
icon: 'glyphicon glyphicon-heart',
238+
displayBadge: true,
239+
height: '200px',
240+
filter: true,
241+
multiSelect: true, // ('multiSelect' also has to be set to 'true')
242+
preSelectItem: true, // allowing pre-select (this has to be set to 'true')
243+
};
244+
245+
```
246+
247+
<h4>preSelectAll:</h4>
248+
<p>Turn pre-selecting of all list items "on" or "off" on load. Default is <code>false</code>, but could be turned "on" by setting <code>true</code>.
249+
NOTE: For pre-select-all to work, <code>multiSelect</code> option must be set to <code>true</code>.
250+
</p>
251+
252+
```javascript
253+
$scope.config = {
254+
options: options,
255+
trackBy: 'Id',
256+
displayBy: [ 'Name', 'Costume' ],
257+
divider: ':',
258+
icon: 'glyphicon glyphicon-heart',
259+
displayBadge: true,
260+
height: '200px',
261+
filter: true,
262+
multiSelect: true, // ('multiSelect' also has to be set to 'true')
263+
preSelectAll: true // allowing pre-select-all
264+
};
265+
266+
```
187267

188268

189269
Compatible with

dist/angular-dropdownMultiselect.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/acorn

Lines changed: 0 additions & 1 deletion
This file was deleted.

node_modules/.bin/browser-sync

Lines changed: 0 additions & 1 deletion
This file was deleted.

node_modules/.bin/buble

Lines changed: 0 additions & 1 deletion
This file was deleted.

node_modules/.bin/dev-ip

Lines changed: 0 additions & 1 deletion
This file was deleted.

node_modules/.bin/express

Lines changed: 0 additions & 1 deletion
This file was deleted.

node_modules/.bin/gulp

Lines changed: 0 additions & 1 deletion
This file was deleted.

node_modules/.bin/har-validator

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)