By default the select takes the item.text and item.value of the data array items and populates the select. Besides the basic text/value interpretation you can write custom render functions for any custom markup printed as a scrollable list.

With the help of the renderItem option you can write a function that returns the custom item markup. Any data field can be used for the template. You'll also want to make sure that the itemHeight is set accordingly.

Download and try example

Demo

Loading the live demo

Preview in full screen

Code

mobiscroll.setOptions({
  locale:  ,
  theme: ' ',
  themeVariant: ' '
});

mobiscroll.select('#demo-item-templating', {
  display: 'anchored',
  itemHeight: 64,
  touchUi: true,
  data: [
    {
      text: 'Mercury – Act 1',
      year: '2021',
      artist: 'Imagine Dragons',
      value: '56243',
      img: 'Mercury_Act_1',
    },
    {
      text: 'Divide',
      year: '2017',
      artist: 'Ed Sheeran',
      value: '18659',
      img: 'Divide',
    },
    {
      text: 'Evolution',
      year: '2018',
      artist: 'Disturbed',
      value: '88459',
      img: 'Evolution',
    },
    {
      text: 'Future Nostalgia',
      year: '2020',
      artist: 'Dua Lipa',
      value: '65422',
      img: 'Future_Nostalgia',
    },
    {
      text: 'Blue Banisters',
      year: '2021',
      artist: 'Lana Del Rey',
      value: '67111',
      img: 'Blue_Banisters',
    },
    {
      text: 'Human',
      year: '2021',
      artist: 'OneRepublic',
      value: '60589',
      img: 'Human',
    },
    {
      text: 'Kamikaze',
      year: '2018',
      artist: 'Eminem',
      value: '42122',
      img: 'Kamikaze',
    },
    {
      text: 'Simulation Theory',
      year: '2018',
      artist: 'Muse',
      value: '80040',
      img: 'Simulation_Theory',
    },
    {
      text: 'The Nothing',
      year: '2019',
      artist: 'Korn',
      value: '46611',
      img: 'Nothing',
    },
  ],
  renderItem: function (item) {
    var data = item.data;
    return (
      '<div class="md-item-template">' +
      '<img class="md-item-template-img" src="https://img.mobiscroll.com/demos/' +
      data.img +
      '.png" />' +
      '<div class="md-item-template-title">' +
      '<span>' +
      data.text +
      '</span>' +
      '<span class="md-item-template-year"> (' +
      data.year +
      ')</span>' +
      '</div>' +
      '<div class="md-item-template-artist">by ' +
      data.artist +
      '</div>' +
      '</div>'
    );
  },
});
  

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.