Click an item to select it, Ctrl+click or Shift+click for several, then use the arrows. Double-clicking an item moves it straight across.

Report columns, in order

jQuery PickList: Default Functionality

jqxPickList is a dual-list picker: users move items between an available list and a selected list with the transfer buttons, a double-click, or the keyboard. This demo picks the columns of a report.

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 () {
    // A report builder: every column the data set has on the left, the columns the
    // report will show on the right. The picker keeps the two lists in sync and
    // reports the selection through its change event.
    var columns = [
        'Order ID', 'Customer', 'Company', 'Country', 'City', 'Product', 'Category',
        'Quantity', 'Unit price', 'Discount', 'Total', 'Order date', 'Ship date',
        'Status', 'Sales rep', 'Region'
    ];

    $('#jqxPickList').jqxPickList({
        width: 620,
        height: 340,
        source: columns,
        selectedItems: ['Order ID', 'Customer', 'Product', 'Total', 'Order date'],
        sourceHeader: 'Available columns',
        targetHeader: 'Report columns'
    });

    var showSelection = function () {
        var selected = $('#jqxPickList').jqxPickList('getSelectedItems');
        $('#selection').text(selected.length ? selected.join(', ') : 'No columns selected - the report would be empty.');
    };
    $('#jqxPickList').on('change', showSelection);
    showSelection();
});

body.html

<div id="content">
    
    <div class="demo">
        <p class="demo-hint">
            Click an item to select it, <kbd>Ctrl</kbd>+click or <kbd>Shift</kbd>+click for several,
            then use the arrows. Double-clicking an item moves it straight across.
        </p>
        <div id="jqxPickList"></div>
        <div class="demo-result">
            <strong>Report columns, in order</strong>
            <span id="selection"></span>
        </div>
    </div>
</div>

More jQuery PickList demos