Opened 5 years ago

Closed 5 years ago

#10189 closed bug (duplicate)

selectmenu refresh sets incorrect buttonText when custom rendering

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

Description

See the refresh function below. I've overridden it with what I believe it should do:

$.widget('custom.myselectmenu', $.ui.selectmenu, {
_renderItem : function(ul, item) {
	var itemElem = this._super(ul, item);
	itemElem.html(item.element.attr('data-content'));
	return itemElem;
},
// Overriding to make label consistent.
refresh : function() {
	this._refreshMenu();
	// The following line incorrectly sets the buttonText to the custom rendered content
	// this._setText( this.buttonText, this._getSelectedItem().text() );
	this._setText(this.buttonText, this.items[this.element[0].selectedIndex].label);
	this._setOption('width', this.options.width);
}});

Change History (1)

comment:1 Changed 5 years ago by tj.vantoll

Component: ui.selectableui.selectmenu
Resolution: duplicate
Status: newclosed

Duplicate of #10142.
Hi achang,

Thanks for taking the time to contribute to jQuery UI. This should be covered by #10142. as we're planning on adding an extension point to handle this.

Note: See TracTickets for help on using tickets.