UI Widgets Pivot

A widget that is similar to a traditional tab control, but optimized for the phone with simplified end-user interaction.

Included in: dx.phonejs.js, dx.all.js
Pivot interactive configuration
Copy code
$("#pivot").dxPivot({
});

The dxPivot widget includes items (tabs). These items are placed horizontally next to one another and navigated by flicking or panning to the left or right, or by choosing the desired pivot header. While you always see the content of one item (tab), the pivot header of the next item is visible so users can clearly see that more items are available. This widget is often used to present lists of data filtered by different criteria. Although dxPivot was created based on the native WindowsPhone8 Pivot widget, it can be used on any platform.

You can create a widget using one of the following approaches.

  • jQuery
    Use the dxPivot jQuery plug-in.

    HTML
    <div id="pivot"></div>
    JavaScript
    $("#pivot").dxPivot({
        dataSource: pivotData
    });
  • Knockout
    Add a div element and apply the dxPivot binding to this element.

    HTML
    <div data-bind="dxPivot: {
        dataSource: pivotData
    }"></div>
  • Angular
    Add a div element and apply the dx-pivot directive to this element.

    HTML
    <div dx-pivot="{
        dataSource: pivotData
    }"></div>

Note that DevExtreme widgets require you to link the jQuery and Globalize libraries to your application. If you use the Knockout or Angular approach, the Knockout or Angular library is also required. For detailed information on linking these libraries to your project, refer to the Installation article.

Since the dxPivot widget is used to display multiple items, it supports common Collection Container widget functionality. You can find detailed information on the principles of working with the widget in the dxPivot section of the Collection Container Widgets article.

View Demo

Watch Video

Show Example:
AngularJS
Knockout
jQuery
<div ng-controller="demoController" style="height:100%;">
    <div dx-pivot="{ dataSource: pivotData }">
        <div data-options="dxTemplate : { name: 'item' } ">
            <div dx-list="{ dataSource: listData }">
                <div data-options="dxTemplate : { name: 'item' } ">
                    <div>{{name}}</div>
                    <div>{{phone}}</div>
                    <div>{{email}}</div>
                </div>
            </div>
        </div>
    </div>
</div>
var contacts = [
        { name: "Barbara J. Coggins", phone: "512-964-2757", email: "BarbaraJCoggins@rhyta.com", category: "Family" },
        { name: "Carol M. Das", phone: "360-684-1334", email: "CarolMDas@jourrapide.com", category: "Friends" },
        { name: "Janet R. Skinner", phone: "520-573-7903", email: "JanetRSkinner@jourrapide.com", category: "Work" },
        { name: "Michael A. Blevins", phone: "530-480-1961", email: "MichaelABlevins@armyspy.com", category: "Favorites" },
        { name: "Jane K. Hernandez", phone: "404-781-0805", email: "JaneKHernandez@teleworm.us", category: "Friends" },
        { name: "Kim D. Thomas", phone: "603-583-9043", email: "KimDThomas@teleworm.us", category: "Work" },
        { name: "Angel H. Padgett", phone: "772-766-2842", email: "AngelHPadgett@jourrapide.com", category: "Family" },
        { name: "Donald L. Jordan", phone: "213-812-8400", email: "DonaldLJordan@dayrep.com", category: "Friends" },
        { name: "Barbara M. Roberts", phone: "614-365-7945", email: "BarbaraMRoberts@armyspy.com", category: "Friends" },
        { name: "Leslie S. Alcantara", phone: "313-881-9719", email: "LeslieSAlcantara@teleworm.us", category: "Work" },
        { name: "Chad S. Miles", phone: "269-718-9780", email: "ChadSMiles@rhyta.com", category: "Friends" },
        { name: "Sherryl C. Flowers", phone: "919-469-3285", email: "SherrylCFlowers@armyspy.com", category: "Friends" },
        { name: "Merle L. Stearns", phone: "213-995-1064", email: "MerleLStearns@jourrapide.com", category: "Friends" },
        { name: "Nicole A. Rios", phone: "240-416-4329", email: "NicoleARios@armyspy.com", category: "Friends" },
        { name: "James L. Parker", phone: "949-265-2198", email: "JamesLParker@teleworm.us", category: "Friends" },
        { name: "Erin G. Goodson", phone: "425-208-5408", email: "ErinGGoodson@rhyta.com", category: "Friends" },
        { name: "Lelia J. Stewart", phone: "580-302-0390", email: "LeliaJStewart@rhyta.com", category: "Family" },
        { name: "Debra B. Abbott", phone: "806-675-3359", email: "DebraBAbbott@jourrapide.com", category: "Work" },
        { name: "Sandra M. Perez", phone: "586-920-6315", email: "SandraMPerez@dayrep.com", category: "Friends" },
        { name: "Elaine R. Coats", phone: "262-397-2323", email: "ElaineRCoats@rhyta.com", category: "Friends" }
];

var myApp = angular.module('myApp', ['dx']);
myApp.controller("demoController", function ($scope) {
    $scope.pivotData = [
        {
            title: "All",
            listData: new DevExpress.data.DataSource({
                store: contacts, sort: "name"
            })
        },
        {
            title: "Family",
            listData: new DevExpress.data.DataSource({
                store: contacts, sort: "name", filter: ["category", "=", "Family"]
            })
        },
        {
            title: "Friends",
            listData: new DevExpress.data.DataSource({
                store: contacts, sort: "name", filter: ["category", "=", "Friends"]
            })
        },
        {
            title: "Work",
            listData: new DevExpress.data.DataSource({
                store: contacts, sort: "name", filter: ["category", "=", "Work"]
            })
        }
    ];
});
angular.element(document).ready(function () {
    angular.bootstrap(document, ['myApp']);
});
<div data-bind="dxPivot: { dataSource: pivotData }">
    <div data-options="dxTemplate : { name: 'item' } ">
        <div data-bind="dxList: { dataSource: listData }">
            <div data-options="dxTemplate : { name: 'item' } ">
                <div data-bind="text: name"></div>
                <div data-bind="text: phone"></div>
                <div data-bind="text: email"></div>
            </div>
        </div>
    </div>
</div>
var contacts = [
        { name: "Barbara J. Coggins", phone: "512-964-2757", email: "BarbaraJCoggins@rhyta.com", category: "Family" },
        { name: "Carol M. Das", phone: "360-684-1334", email: "CarolMDas@jourrapide.com", category: "Friends" },
        { name: "Janet R. Skinner", phone: "520-573-7903", email: "JanetRSkinner@jourrapide.com", category: "Work" },
        { name: "Michael A. Blevins", phone: "530-480-1961", email: "MichaelABlevins@armyspy.com", category: "Favorites" },
        { name: "Jane K. Hernandez", phone: "404-781-0805", email: "JaneKHernandez@teleworm.us", category: "Friends" },
        { name: "Kim D. Thomas", phone: "603-583-9043", email: "KimDThomas@teleworm.us", category: "Work" },
        { name: "Angel H. Padgett", phone: "772-766-2842", email: "AngelHPadgett@jourrapide.com", category: "Family" },
        { name: "Donald L. Jordan", phone: "213-812-8400", email: "DonaldLJordan@dayrep.com", category: "Friends" },
        { name: "Barbara M. Roberts", phone: "614-365-7945", email: "BarbaraMRoberts@armyspy.com", category: "Friends" },
        { name: "Leslie S. Alcantara", phone: "313-881-9719", email: "LeslieSAlcantara@teleworm.us", category: "Work" },
        { name: "Chad S. Miles", phone: "269-718-9780", email: "ChadSMiles@rhyta.com", category: "Friends" },
        { name: "Sherryl C. Flowers", phone: "919-469-3285", email: "SherrylCFlowers@armyspy.com", category: "Friends" },
        { name: "Merle L. Stearns", phone: "213-995-1064", email: "MerleLStearns@jourrapide.com", category: "Friends" },
        { name: "Nicole A. Rios", phone: "240-416-4329", email: "NicoleARios@armyspy.com", category: "Friends" },
        { name: "James L. Parker", phone: "949-265-2198", email: "JamesLParker@teleworm.us", category: "Friends" },
        { name: "Erin G. Goodson", phone: "425-208-5408", email: "ErinGGoodson@rhyta.com", category: "Friends" },
        { name: "Lelia J. Stewart", phone: "580-302-0390", email: "LeliaJStewart@rhyta.com", category: "Family" },
        { name: "Debra B. Abbott", phone: "806-675-3359", email: "DebraBAbbott@jourrapide.com", category: "Work" },
        { name: "Sandra M. Perez", phone: "586-920-6315", email: "SandraMPerez@dayrep.com", category: "Friends" },
        { name: "Elaine R. Coats", phone: "262-397-2323", email: "ElaineRCoats@rhyta.com", category: "Friends" }
];

var myViewModel = {
    pivotData: [
        {
            title: "All",
            listData: new DevExpress.data.DataSource({
                store: contacts, sort: "name"
            })
        },
        {
            title: "Family",
            listData: new DevExpress.data.DataSource({
                store: contacts, sort: "name", filter: ["category", "=", "Family"]
            })
        },
        {
            title: "Friends",
            listData: new DevExpress.data.DataSource({
                store: contacts, sort: "name", filter: ["category", "=", "Friends"]
            })
        },
        {
            title: "Work",
            listData: new DevExpress.data.DataSource({
                store: contacts, sort: "name", filter: ["category", "=", "Work"]
            })
        }
    ]
}
ko.applyBindings(myViewModel);
<div id="myPivot"></div>
var contacts = [
        { name: "Barbara J. Coggins", phone: "512-964-2757", email: "BarbaraJCoggins@rhyta.com", category: "Family" },
        { name: "Carol M. Das", phone: "360-684-1334", email: "CarolMDas@jourrapide.com", category: "Friends" },
        { name: "Janet R. Skinner", phone: "520-573-7903", email: "JanetRSkinner@jourrapide.com", category: "Work" },
        { name: "Michael A. Blevins", phone: "530-480-1961", email: "MichaelABlevins@armyspy.com", category: "Favorites" },
        { name: "Jane K. Hernandez", phone: "404-781-0805", email: "JaneKHernandez@teleworm.us", category: "Friends" },
        { name: "Kim D. Thomas", phone: "603-583-9043", email: "KimDThomas@teleworm.us", category: "Work" },
        { name: "Angel H. Padgett", phone: "772-766-2842", email: "AngelHPadgett@jourrapide.com", category: "Family" },
        { name: "Donald L. Jordan", phone: "213-812-8400", email: "DonaldLJordan@dayrep.com", category: "Friends" },
        { name: "Barbara M. Roberts", phone: "614-365-7945", email: "BarbaraMRoberts@armyspy.com", category: "Friends" },
        { name: "Leslie S. Alcantara", phone: "313-881-9719", email: "LeslieSAlcantara@teleworm.us", category: "Work" },
        { name: "Chad S. Miles", phone: "269-718-9780", email: "ChadSMiles@rhyta.com", category: "Friends" },
        { name: "Sherryl C. Flowers", phone: "919-469-3285", email: "SherrylCFlowers@armyspy.com", category: "Friends" },
        { name: "Merle L. Stearns", phone: "213-995-1064", email: "MerleLStearns@jourrapide.com", category: "Friends" },
        { name: "Nicole A. Rios", phone: "240-416-4329", email: "NicoleARios@armyspy.com", category: "Friends" },
        { name: "James L. Parker", phone: "949-265-2198", email: "JamesLParker@teleworm.us", category: "Friends" },
        { name: "Erin G. Goodson", phone: "425-208-5408", email: "ErinGGoodson@rhyta.com", category: "Friends" },
        { name: "Lelia J. Stewart", phone: "580-302-0390", email: "LeliaJStewart@rhyta.com", category: "Family" },
        { name: "Debra B. Abbott", phone: "806-675-3359", email: "DebraBAbbott@jourrapide.com", category: "Work" },
        { name: "Sandra M. Perez", phone: "586-920-6315", email: "SandraMPerez@dayrep.com", category: "Friends" },
        { name: "Elaine R. Coats", phone: "262-397-2323", email: "ElaineRCoats@rhyta.com", category: "Friends" }
];

$("#myPivot").dxPivot({
    dataSource: [
        {
            title: "All",
            listData: new DevExpress.data.DataSource({
                store: contacts, sort: "name"
            })
        },
        {
            title: "Family",
            listData: new DevExpress.data.DataSource({
                store: contacts, sort: "name", filter: ["category", "=", "Family"]
            })
        },
        {
            title: "Friends",
            listData: new DevExpress.data.DataSource({
                store: contacts, sort: "name", filter: ["category", "=", "Friends"]
            })
        },
        {
            title: "Work",
            listData: new DevExpress.data.DataSource({
                store: contacts, sort: "name", filter: ["category", "=", "Work"]
            })
        }
    ],
    itemTemplate: function (itemData, itemIndex, itemElement) {
        var list = $("<div>");
        list.dxList({
            dataSource: itemData.listData,
            itemTemplate: function (itemData, itemIndex, itemElement) {
                itemElement.append("<div>" + itemData.name + "</div>");
                itemElement.append("<div>" + itemData.phone + "</div>");
                itemElement.append("<div>" + itemData.email + "</div>");
            }
        });
        itemElement.append(list);
    }
});

Configuration

An object defining configuration options for the dxPivot widget.

Methods

This section describes members used to manipulate the widget.

Events

This section describes events fired by this widget.

Default Item Template

This section lists the data source fields that are used in a default template for pivot items.

By default, a predefined item template is applied to display the items of this widget. This template is based on certain fields of the data source provided for this widget. Below is the list of these fields. If the default item template is not appropriate for your task, implement a custom item template based on these or other fields of your data source.

See Also