Can't load webix jet combo box

I don’t get why this combo doesn’t work:

models/cities.js

define([], function() {
  var collection = new webix.DataCollection({
    data: [
	{ city:"ANN ARBOR"},
	{ city:"BELLEVILLE"},
	{ city:"DEXTER"},
	{ city:"MANCHESTER"},
	{ city:"NORTHVILLE"},
	{ city:"YPSILANTI"}
    ]
  });

  return {
    data: collection
  };

});

views/address_form.js

define(["models/cities"], function(cities) {

  var addressElements = [
	{
	  cols: [
		{
		  view: "text",
		  label: "Address",
		  name: "address",
		  width: 400
		},
		{
		  view: "combo",
		  label: "City",
		  name: "city",
		  width: 300,
		  editable: true,
		  options: cities
		},
		{
		  view: "text",
		  label: "Zip:",
		  name: "zip",
		  width: 200
		}
	  ]
	}
  ];

  var addressForm = {
	view: "form",
	id: "addressForm",
	elements: addressElements
  };

  var ui = {
	rows: [
	  addressForm
	]
  };

  return {
	$ui: ui
  }

});

Combo box has correct number of options but all are “undefined”.

Hello,

You should provide a template for a combo popup list, as by default it displays value property while you need to show city: https://webix.com/snippet/c04ca3c0

Please check the related documentation article.

Thanks for the reply. I assume you mean like this:

    {
      view: "combo",
      label: "City",
      name: "city",
      width: 300,
      editable: true,
      template: "#city#",
      options: cities
    },

Which I tried but got “Invalid node as target for webix.event”.

Just noticed your snippet. Still no joy. This

    {
      view: "combo",
      label: "City",
      name: "city",
      width: 300,
      editable: true,
      suggest: {
        data: cities,
        body: {
          template: "#city#"
        }
      }
    },

Gets no errors but the dropdown has just a single “undefined”.

You need to ensure that you pass the DataCollection as data for a combo control.

https://webix.com/snippet/e4a13cbf

Ah, so data: cities.data. That did the trick, thanks.

Helga, thanks again for the help on this. I wonder if you might look at my other question which has had some reviews but no comments. Am I going to have to specify a hard-coded height for every subview?