Dropdown field binding issue

  1. #1

    Dropdown field binding issue

    Below is the javascript function which i am using to bind values to the dropdown using ddlCou.innerText = option.text; only the last option is getting displayed as a label but i need to have a dropdown functionality with select at first and remaining all values which are in result[i]

    function loadCountriesDropDown() {
            var ddlCou = document.getElementById('ddlCountriesId');
            var countyStates = [];
            for (var i = 0; i < data.List.length; i++) {
                countyStates.push(data.List[i].Name);
            }
            var result = countyStates.map(function (obj) { return obj.Name; });
            result = result.filter(function (v, i) { return result.indexOf(v) == i; });
            for (var i = 0; i < result.length; i++) {
                var option = document.createElement("option");
                option.text = result[i];
                ddlCou.innerText = option.text;
            }
    }
    <ext:ComponentColumn runat="server">
      <Items>
        <ext:DropDownField runat="server" ID="ddlCountriesId" ClientIDMode="Static"></ext:DropDownField>
      </Items>
    </ext:ComponentColumn>
  2. #2
    Hello, @avair!

    The DropDownField component is meant to display a complex component as the dropdown box, so it doesn't really handle multiple data, the underlying component "picker" does. Take a look at its overview example: Form > Dropdown Field > Overview

    Perhaps what you need is a read-only combo box? Or a searchable combo box which requires a valid selection from the list of accepted entries? Take a look at this example: Form > Combo Box > Ajax Linked Combos for it has both examples mentioned, respectively.

    Hope this helps!

    p.s.: notice it's difficult for us to tell whether your code snippet works or not, how it does, and what to do to make it so. Providing fully runnable test cases allows us to see exactly what you mean and provide more accurate responses. Refer to the following threads for more information:

    - Tips for creating simplified code samples
    - More Information Required
    - Forum Guidelines
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 0
    Last Post: May 13, 2014, 5:32 AM
  2. DropDown Field in mvc.ext.net with Model
    By novacp in forum 2.x Help
    Replies: 1
    Last Post: Apr 01, 2014, 7:45 AM
  3. [CLOSED] dropdown field width
    By rnachman in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Oct 02, 2012, 7:28 PM
  4. [CLOSED] Pecilluar issue in the DropDown, UI Issue
    By Shanth in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Feb 22, 2012, 12:02 PM
  5. [CLOSED] Dropdown Field List Position
    By amitpareek in forum 1.x Legacy Premium Help
    Replies: 10
    Last Post: Apr 14, 2011, 7:04 PM

Tags for this Thread

Posting Permissions