Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
160
igCombo selected item at top when combo opened
posted

How can I get the selected item of an igCombo scrolled to the top of the opened combo when the combo is opened?

[    Combo Box                      | v ]

--------------------------------

   Selected Item          <=================

--------------------------------

  Non-selected item 1

--------------------------------

  Non-selected item 2

Parents
No Data
Reply
  • 16310
    Offline posted

    Hi Justin,

    you can achieve the required in the dropDownOpening event:

    dropDownOpening: function (evt, ui) {
    	if (ui.owner.selectedItems()) {
    		var selectedNode = ui.owner.selectedItems()[0].element[0].cloneNode(true);
    		ui.owner.selectedItems()[0].element[0].remove();
    		var listHolder = ui.owner.dropDown().find(".ui-igcombo-listitemholder")[0];
    		listHolder.insertBefore(selectedNode, listHolder.firstElementChild);
    	}
    }

    Please review the jsfiddle to see this working and let me know if you have more questions.

Children