Skip to content

Commit ef948c0

Browse files
committed
Update readme
1 parent 6c65199 commit ef948c0

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

README.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,33 @@ $('select').selectric({
177177
*
178178
* If it's a string, all keys wrapped in brackets will be replaced by
179179
* the respective values in itemData. Available keys are:
180-
* 'value', 'text', 'slug', 'disabled'.
180+
* 'value', 'text', 'slug', 'index'.
181181
*
182-
* If it's a function, it will be called with the following parameters:
183-
* (itemData, element, index). The function must return a string,
184-
* no keys will be replaced in this method.
182+
* If it's a function, it will be called with the following parameter:
183+
* (itemData). The function must return a string. If available all keys
184+
* will be replaced by the respective values in itemData.
185+
*
186+
* itemData<Object> {
187+
* className // Type: String. Description: option class names.
188+
* disabled // Type: Boolean. Description: option is disabled true/false
189+
* selected // Type: Boolean. Description: option is selected true/false
190+
* element // Type: HTMLDomElement. Description: current select element
191+
* index // Type: Number. Description: current option index
192+
* slug // Type: String. Description: option slug
193+
* text // Type: String. Description: option text
194+
* value // Type: String. Description: option value
195+
* }
196+
*
197+
* EXAMPLE:
198+
*
199+
* function(itemData) {
200+
* return '{text}';
201+
* }
202+
*
203+
* // you're free to build and return your own strings
204+
* function(itemData) {
205+
* return itemData.text + '(' + itemData.index + ')';
206+
* }
185207
*/
186208
optionsItemBuilder: '{text}',
187209

0 commit comments

Comments
 (0)