Select a panel on the right and use the up and down arrows to change its position. The preview follows the order of the selected list.

Dashboard preview

jQuery PickList: Reordering

jqxPickList with reorderable: true adds Move up and Move down buttons for the selected list, so the order of the selection means something - here, the order of the panels on a dashboard. getSelectedValues() returns the items in the order shown.

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 dashboard with a fixed set of panels. The user chooses which to show AND in
    // what order: the selected list's order is the layout, and Move up / Move down
    // rearrange it. The preview below re-renders from getSelectedValues().
    var panels = [
        'Revenue', 'New customers', 'Open orders', 'Conversion rate', 'Support tickets',
        'Top products', 'Sales by region', 'Inventory alerts', 'Team activity', 'Churn'
    ];

    $('#jqxPickList').jqxPickList({
        width: 640,
        height: 320,
        source: panels,
        selectedItems: ['Revenue', 'Open orders', 'Top products', 'Support tickets'],
        sourceHeader: 'Available panels',
        targetHeader: 'Dashboard, top to bottom',
        reorderable: true
    });

    var preview = function () {
        var order = $('#jqxPickList').jqxPickList('getSelectedValues');
        var board = $('#board').empty();
        if (!order.length) {
            board.append('<div class="empty">No panels selected</div>');
            return;
        }
        $.each(order, function (i, name) {
            board.append($('<div></div>').append($('<span></span>').text('Panel ' + (i + 1))).append(document.createTextNode(name)));
        });
    };
    $('#jqxPickList').on('change reordered', preview);
    preview();
});

body.html

<div id="content">
    
    <div class="demo">
        <p class="demo-hint">
            Select a panel on the right and use the up and down arrows to change its position. The preview follows the order of the selected list.
        </p>
        <div id="jqxPickList"></div>
        <div class="demo-preview">
            <strong>Dashboard preview</strong>
            <div id="board" class="demo-board"></div>
        </div>
    </div>
</div>

More jQuery PickList demos