Populating the picker

The select component takes care of rendering data in a scrollable and consumable way for the user. The date can be passed a couple of different ways:

  • Inline HTML, embedded in the markup - This is good if you only have a couple of static options.
  • With the data option - If you want to load model data this is the way to do it. This is the way to populate the select if you want to create a custom item template.
  • Remote data - Load it through the data option from a remote api/data source.
Download and try example

Demo

Inline HTML

The select and options are embedded in the markup.

html<label>
    HTML
    <input mbsc-input id="my-input" data-dropdown="true" />
</label>
<select id="my-select">
    <option value="atl">Atlanta</option>
    <option value="ber">Berlin</option>
    <option value="bos">Boston</option>
    <option value="chi">Chicago</option>
    <option value="lon">London</option>
    <option value="la">Los Angeles</option>
    <option value="ny">New York</option>
    <option value="par">Paris</option>
    <option value="sf">San Francisco</option>
</select>
jsmobiscroll.select('#my-select', {
        inputElement: document.getElementById('my-input'),
        touchUi: 
    });
Data object

Pass the items to the data option if you are loading from the model or in case of item templating.

html<label>
    Data object
    <input mbsc-input id="my-select" data-dropdown="true" />
</label>
jsmobiscroll.select('#my-select', {
    touchUi: ,
    data: [
        { text: 'Atlanta', value: 'atl' },
        { text: 'Berlin', value: 'ber' },
        { text: 'Boston', value: 'bos' },
        { text: 'Chicago', value: 'chi' },
        { text: 'London', value: 'lon' },
        { text: 'Los Angeles', value: 'la' },
        { text: 'New York', value: 'ny' },
        { text: 'Paris', value: 'par' },
        { text: 'San Francisco', value: 'sf' }
    ]
});
Remote data

The data loaded from a remote source needs to be passed to the data option as in the previous example.

html<label>
    Remote data
    <input mbsc-input id="my-select" data-dropdown="true" />
</label>
jsvar inst = mobiscroll.select('#my-select', {
    touchUi: 
});

mobiscroll.getJson('https://trial.mobiscroll.com/content/languages.json', function (resp) {
    inst.setOptions({ data: resp });
}, 'jsonp');

Duplicate Session

You have signed in on a different machine. To keep everything in sync, you have been signed out of this session.

If you need to invite team members, manage seats and accounts you can do it from the licenses page.

Duplicate Session

We noticed you are logged in on a different machine and have closed your old session.

If you need to invite team members, manage seats and accounts you can do it from the licenses page.