@@ -254,15 +254,37 @@ <h2>Options</h2>
254
254
255
255
/*
256
256
* Type: String or Function
257
- * Description: Define how each option should be rendered inside its < li > element.
257
+ * Description: Define how each option should be rendered inside its <li> element.
258
258
*
259
259
* If it's a string, all keys wrapped in brackets will be replaced by
260
260
* the respective values in itemData. Available keys are:
261
- * 'value', 'text', 'slug', 'disabled '.
261
+ * 'value', 'text', 'slug', 'index '.
262
262
*
263
- * If it's a function, it will be called with the following parameters:
264
- * (itemData, element, index). The function must return a string,
265
- * no keys will be replaced in this method.
263
+ * If it's a function, it will be called with the following parameter:
264
+ * (itemData). The function must return a string. If available all keys
265
+ * will be replaced by the respective values in itemData.
266
+ *
267
+ * itemData<Object> {
268
+ * className // Type: String. Description: option class names.
269
+ * disabled // Type: Boolean. Description: option is disabled true/false
270
+ * selected // Type: Boolean. Description: option is selected true/false
271
+ * element // Type: HTMLDomElement. Description: current select element
272
+ * index // Type: Number. Description: current option index
273
+ * slug // Type: String. Description: option slug
274
+ * text // Type: String. Description: option text
275
+ * value // Type: String. Description: option value
276
+ * }
277
+ *
278
+ * EXAMPLE:
279
+ *
280
+ * function(itemData) {
281
+ * return '< span class ="item-{index} "> {text}</ span > ';
282
+ * }
283
+ *
284
+ * // you're free to build and return your own strings
285
+ * function(itemData) {
286
+ * return itemData.text + '(' + itemData.index + ')';
287
+ * }
266
288
*/
267
289
optionsItemBuilder: '{text}',
268
290
0 commit comments