The following block of code (in jquery.dj.selectable.js) doesn't seem to do what it is supposed to:
if (this.selectableType === 'combobox') { // Add show all items button button = this._comboButtonTemplate($input); button.insertAfter($input).click(function (e) { e.preventDefault(); // close if already visible if (self.widget().is(":visible")) { self.close(); } // pass empty string as value to search for, displaying all results self._search(""); $input.focus(); });
If the menu from the combobox is visible and you press the combobox again, then the menu opens again. It would be better if it closed itself. The reason is that self.widget().is(":visible") always evaluates to false. A possible fix may look something like:
if (this.selectableType === 'combobox') { // Adds a button that displays all possible menu options when pressed button = this._comboButtonTemplate($input); button.insertAfter($input).click(function (event) { event.preventDefault(); // Close dropdown menu if it is already visible and disable focus if (self.visible){ self.close(); $input.focus(); self.visible = false }else{ // pass empty string as value to search for, displaying all results self._search(""); $input.focus(); self.visible = true } });
In addition, it would be cool if the combobox- icon changed to "ui-icon-triangle-2-s" when the menu is displaying (I.e. a upside down triangle, indicating that the button now results in the menu closing).
The following block of code (in jquery.dj.selectable.js) doesn't seem to do what it is supposed to:
if (this.selectableType === 'combobox') { // Add show all items button button = this._comboButtonTemplate($input); button.insertAfter($input).click(function (e) { e.preventDefault(); // close if already visible if (self.widget().is(":visible")) { self.close(); } // pass empty string as value to search for, displaying all results self._search(""); $input.focus(); });
If the menu from the combobox is visible and you press the combobox again, then the menu opens again. It would be better if it closed itself. The reason is that self.widget().is(":visible") always evaluates to false. A possible fix may look something like:
if (this.selectableType === 'combobox') { // Adds a button that displays all possible menu options when pressed button = this._comboButtonTemplate($input); button.insertAfter($input).click(function (event) { event.preventDefault(); // Close dropdown menu if it is already visible and disable focus if (self.visible){ self.close(); $input.focus(); self.visible = false }else{ // pass empty string as value to search for, displaying all results self._search(""); $input.focus(); self.visible = true } });
In addition, it would be cool if the combobox- icon changed to "ui-icon-triangle-2-s" when the menu is displaying (I.e. a upside down triangle, indicating that the button now results in the menu closing).