UI Widgets TileView

A widget displaying several blocks of data as tiles.

Type: Object

The dxTileView widget displays objects of a different size and reorders them so that they fit on the screen. The width and height of each tile's view element is a multiple of the base width and base height specified with the baseItemWidth and baseItemHeight configuration options, respectively. The base width and base height are specified in pixels.

Like a regular list, the tile view consists of items that can perform an associated action when clicked. The list items are loaded from an array specified from the dataSource configuration option. You can specify a simple array or an array of objects as the data source.

JavaScript
var tileViewData = [
      { name: "Alabama", capital: "Montgomery", population: 4822023, area: 135765 },
      { name: "Alaska", capital: "Juneau", population: 731449, area: 1717854 },
      { name: "Arizona", capital: "Phoenix", population: 6553255, area: 295254 },
      { name: "Arkansas", capital: "Little Rock", population: 2949131, area: 137002 },
      { name: "California", capital: "Sacramento", population: 38041430, area: 423970 },
      { name: "Colorado", capital: "Denver", population: 5187582, area: 269602 },
      { name: "Connecticut", capital: "Hartford", population: 3590347, area: 14356 }
      ...
];

Check out the widthRatio and heightRatio fields of objects stored in the data source. These field values are used as multipliers for the baseItemWidth and baseItemHeight option values for the purpose of obtaining the actual item width and height.

To create a dxTileView widget, add a div element with dxTileView binding within the body of the required view to create the dxTileView widget, and insert an item template into the widget container tag to specify the formatting for items.

HTML
<div data-bind="dxTileView:{dataSource: tileViewData, baseItemHeight: 150, baseItemWidth: 150}">
    <div data-options="dxTemplate:{name:'item'}">
        <h1 data-bind="text: name"></h1>
        <p>Area: <i data-bind="text: area"></i> km2</p>
        <p>Population: <i data-bind="text: population"></i></p>
        <p>Capital: <i data-bind="text: capital"></i></p>
    </div>
</div>

See the Customize Widget Item Appearance topic to learn how to adjust the appearance of widget items.

Refer to the Add a widget documentation section to learn how to create widgets in detail.

Show Example:
jQuery
<div class="tileView" data-bind="dxTileView: {
  dataSource: tileViewData,
  itemMargin: 20,
  baseItemHeight: 130,
  baseItemWidth: 180
}">
    <div class="tile" data-options="dxTemplate:{name:'item'}">
        <p style="font-size:larger;"><b data-bind="text: name"></b></p>
    <img style="margin:5px;" data-bind="attr: { src: getImagePath(name) }" />
        <p>Capital: <i data-bind="text: capital"></i></p>
    </div>
</div>
//An object passed to the dataSource configuration option of the tile view
tileViewData = [
  { name: "Alabama", capital: "Montgomery", population: 4822023, area: 135765 },
  { name: "Alaska", capital: "Juneau", population: 731449, area: 1717854, heightRatio: 2 },
  { name: "Arizona", capital: "Phoenix", population: 6553255, area: 295254 },
  { name: "Arkansas", capital: "Little Rock", population: 2949131, area: 137002, widthRatio: 2 },
  { name: "California", capital: "Sacramento", population: 38041430, area: 423970 },
  { name: "Colorado", capital: "Denver", population: 5187582, area: 269602 },
  { name: "Connecticut", capital: "Hartford", population: 3590347, area: 14356 }
];

//Generates the path to the required image file
getImagePath = function (name) {
  return "/Content/images/doc/13_1/PhoneJS/flags/" + name.replace(" ", "") + ".gif";
};
.tile {
  border-radius: .5em;
  text-align: center;
  color: white;
  background: gray;
}

Configuration

An object defining configuration options for the dxTileView widget.

Methods

This section describes members used to manipulate the object.