diff --git a/README.md b/README.md index dcdd4b6..c0399e1 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,11 @@ based on asmSelect - Alternate Select Multiple by Ryan Cramer * Keeps original select multiple visible so that you can monitor live changes made to it when debugging. * Default: false +* extractLabel: + + * A function to compute the list element name from the option object + * Default: extract the option html + ### Text Labels ### * title @@ -141,6 +146,7 @@ github latest: * support for optgroup * ability to set the default select title via the configuration * make the original label point to the new select + * ability to customize the way list label gets extracted from the option 2010-07-02: diff --git a/examples/index.html b/examples/index.html index c6cdf64..7d0070e 100644 --- a/examples/index.html +++ b/examples/index.html @@ -100,7 +100,8 @@ listClass: 'bsmList-custom', // Class for the list ($ol) listItemClass: 'bsmListItem-custom', // Class for the
  • list items listItemLabelClass: 'bsmListItemLabel-custom', // Class for the label text that appears in list items - removeClass: 'bsmListItemRemove-custom' // Class given to the "remove" link + removeClass: 'bsmListItemRemove-custom', // Class given to the "remove" link + extractLabel: function($o) {return ">>" + $o.html();} }); }); @@ -207,6 +208,7 @@

    Execizing the features added over asmSelect

  • Custom effects
  • Option groups
  • Setting the title in the configuration
  • +
  • Customize the way list element labels get extracted
  • diff --git a/jquery.bsmselect.js b/jquery.bsmselect.js index e07bddd..5fe46cc 100644 --- a/jquery.bsmselect.js +++ b/jquery.bsmselect.js @@ -14,6 +14,7 @@ * - support for optgroup * - ability to set the default select title via the configuration * - make the original label point to the new select + * - ability to customize the way list label gets extracted from the option * v1.0 - 2010-07-02: * - initial release * @@ -224,7 +225,7 @@ var $itemLabel = $("", { "class": conf.listItemLabelClass, - html: $O.html() + html: conf.extractLabel($O, conf) }); var $item = $("
  • ", { @@ -357,6 +358,7 @@ removeLabel: 'remove', // Text used in the "remove" link highlightAddedLabel: 'Added: ', // Text that precedes highlight of added item highlightRemovedLabel: 'Removed: ', // Text that precedes highlight of removed item + extractLabel: function($option) { return $option.html(); }, containerClass: 'bsmContainer', // Class for container that wraps this widget selectClass: 'bsmSelect', // Class for the newly created