Skip to main content

Search and Top Navigation

#10143 closed bug (notabug)

Opened July 08, 2014 03:50PM UTC

Closed July 08, 2014 05:08PM UTC

Can't bind to prototypes in _renderItem

Reported by: spjonez Owned by:
Priority: minor Milestone: none
Component: ui.selectmenu Version: 1.11.0
Keywords: Cc:
Blocked by: Blocking:

In the original plugin a 'format' function was passed during init to style items. Now it's a global widget call to create a new method. This presents a problem when you are writing function prototypes and do not have (or want) to use the global name to scope callbacks.


format: function( aItem ) {

return self.textSelectFormatting( aItem );


'self' is a reference to the objects 'this' before it has been instantiated. In the original textSelectFormatting would return markup and I could bind a click event to the new markup using the correct scope.

Is this possible with the new design? Or am I stuck binding an event to another object that I can trigger and pass the item that was clicked on to get my object reference?

Attachments (0)
Change History (2)

Changed July 08, 2014 04:54PM UTC by spjonez comment:1

You can close/delete this, using $( selector ).data( 'uiSelectmenu' )._renderItem = function( aUl, aItem ) seems to work.

Changed July 08, 2014 05:08PM UTC by tj.vantoll comment:2

resolution: → notabug
status: newclosed

Replying to [comment:1 spjonez]:

You can close/delete this, using $( selector ).data( 'uiSelectmenu' )._renderItem = function( aUl, aItem ) seems to work.

fyi you can use

$( selector ).selectmenu( "instance" )._renderItem
as of 1.11. See also the approach I used in #10142.

I created an issue to document selectmenu's extension points, because we missed those: For now you can look at autocomplete method of the same name which is documented (, and works the same way.