Gallery

An image gallery widget.

Type: Object

The dxGallery widget displays images in a horizontally scrolled view.

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

HTML
<div data-bind="dxGallery: { dataSource: galleryData }"></div>

Gallery images are loaded from an array specified via the dataSource configuration option. You can specify a DataSource object, a simple array, or an array of objects as the widget data source.

JavaScript
var galleryData = [
    "images/img1.png",
    "images/img2.png",
    "images/img3.png",
    "images/img4.png"
];

To display widget 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.

You can introduce a custom template for widget items. 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.

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

Show Example:
jQuery

Configuration

An object defining configuration options for the dxGallery widget.

Methods

This section describes members used to manipulate the widget.

Events

This section describes events fired by this component.