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.

To create a dxTileView widget, add a div element with dxTileView binding within the body of the required view to create the dxTileView widget.

HTML
<div data-bind="dxTileView:{dataSource: tileViewData, baseItemHeight: 150, baseItemWidth: 150}"></div>

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 }
      ...
 ];

To display the widget's items, a default template is applied based on the following fields of the data source item objects.

  • disabled
    Specifies whether or not the gallery item is disabled.
  • visible
    Specifies whether or not the gallery item is visible.
  • html
    Specifies the html code inserted into the item element.
  • text
    Specifies the text inserted into the item element.
  • heightRatio
    Specifies a multiplier for the baseItemHeight option value (for the purpose of obtaining the actual item height).
  • widthRatio
    Specifies a multiplier for the baseItemWidth option value (for the purpose of obtaining the actual item width).

You can introduce a custom template for tiles. For this purpose, add a div element with the data-options attribute set to dxTemplate. Assign item to the template name. In this instance, the template will be applied automatically. See the Customize Widget Item Appearance topic to learn more about templates.

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>

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: tileViewDataSource,
  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
tileViewDataSource = new DevExpress.data.DataSource("/Content/data/states.txt");

//Generates the path to the required image file
getImagePath = function (name) {
  return "/Content/images/doc/13_2/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 methods that can be used to manipulate a widget.

Events

This section describes events fired by this component.