Each row is rendered by the renderer callback from the item object. Selection, transfer and keyboard navigation work exactly as with plain text items.

Team

jQuery PickList: Item Templates

jqxPickList with a custom item template: the renderer callback returns the HTML for each item, so a list can show an avatar, a name and a second line instead of plain text. itemHeight makes room for the two lines.

A live JavaScript/jQuery example of jqxPickList, the jQWidgets PickList component, with its complete source code below. It is one of 7 jqxPickList demos for jQuery.

jqxPickList API used in this demo

Source code

To run it in your own page, load jqx.base.css, a theme and the library files below from npm (npm install jqwidgets-scripts) or the jsDelivr CDN, then add the markup and the script. jQuery is not required: jqxcore.js provides $.

The page loads jqx.base.css, a theme and these library files: jqxcore.js, jqxbuttons.js, jqxscrollbar.js, jqxlistbox.js, jqxpicklist.js.

It also loads helper scripts of this demo site, which are not part of the library: demos.js (getWidth() and other layout helpers).

script.js

$(document).ready(function () {
    // Building a project team. Each item is an object; the renderer turns it into an
    // avatar with initials, the name, and the role underneath. displayMember still
    // drives filtering and the accessible name; valueMember is what is selected.
    var people = [
        { id: 101, name: 'Ada Lovelace', role: 'Engineering lead' },
        { id: 102, name: 'Grace Hopper', role: 'Backend engineer' },
        { id: 103, name: 'Margaret Hamilton', role: 'Systems engineer' },
        { id: 104, name: 'Linus Torvalds', role: 'Platform engineer' },
        { id: 105, name: 'Barbara Liskov', role: 'Architect' },
        { id: 106, name: 'Ken Thompson', role: 'Backend engineer' },
        { id: 107, name: 'Radia Perlman', role: 'Network engineer' },
        { id: 108, name: 'Donald Knuth', role: 'Technical writer' },
        { id: 109, name: 'Frances Allen', role: 'Compiler engineer' },
        { id: 110, name: 'Dennis Ritchie', role: 'Systems engineer' }
    ];
    var colours = ['#2563eb', '#059669', '#d97706', '#7c3aed', '#db2777', '#0891b2', '#dc2626', '#4f46e5', '#65a30d', '#ea580c'];
    var esc = function (s) { return $('<div></div>').text(s).html(); };
    var initials = function (name) {
        return name.split(' ').map(function (p) { return p.charAt(0); }).join('').toUpperCase();
    };

    $('#jqxPickList').jqxPickList({
        width: 640,
        height: 400,
        source: people,
        displayMember: 'name',
        valueMember: 'id',
        selectedItems: [101, 105],
        sourceHeader: 'People',
        targetHeader: 'Project team',
        itemHeight: 44,
        // item: the source object; label: displayMember; value: valueMember
        renderer: function (item, label, value, index) {
            return '<div class="person">' +
                '<span class="avatar" style="background:' + colours[item.id % colours.length] + '">' + esc(initials(item.name)) + '</span>' +
                '<span class="text"><span class="name">' + esc(item.name) + '</span><span class="role">' + esc(item.role) + '</span></span>' +
                '</div>';
        }
    });

    var show = function () {
        var team = $('#jqxPickList').jqxPickList('getSelectedItems');
        $('#selection').text(team.length ? team.map(function (p) { return p.name; }).join(', ') : 'Nobody yet.');
    };
    $('#jqxPickList').on('change', show);
    show();
});

body.html

<div id="content">
    
    <div class="demo">
        <p class="demo-hint">
            Each row is rendered by the <code>renderer</code> callback from the item object. Selection, transfer and keyboard navigation work exactly as with plain text items.
        </p>
        <div id="jqxPickList"></div>
        <div class="demo-result">
            <strong>Team</strong>
            <span id="selection"></span>
        </div>
    </div>
</div>

More jQuery PickList demos