Populate select drop-down with api-result/or list

Hi,
Am trying to populate a drop-down options with an api-response which I can put into a tmpList = [] or straight away from the response depending on what's easiest?
How do I do this? Want the Code value(from list at the bottom) to populate the dropdownlist

                   {
                    view: "select",
                    id: "anId",
                    placeholder: ("Name"),
                    label: "Some User",
                    name: "Name",
                    labelPosition: "top",
                    options:[],
                   }

Here is the response I get from my api which I've put into a tmpList = [] which I then want to populate the options:[] as a drop down below where I want to show the value of the Code value.
0: {Code: "Hello", Name: "John Doe", DisplayName: "John"}
1: {Code: "GooBye", Name: "Jane Doe", DisplayName: "Cherry"}
2: {Code: "Ebenezar", Name: "Mr Scrooge", DisplayName: "Nice"}

Comments

  • edited June 8

    Hi, is this what you were aiming to get? https://snippet.webix.com/ighsc7ov
    "select" is unfortunately not so customizable as "combo" and "richselect"

  • edited June 8
    init() {
        api.get("theUrl", res => {
            this.$$("anId").define("options", res.json().map(x => x.Code));
        })
    }
    

    This is what solved it for me.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion