Properties Methods Events Config Options Direct Link
Observable
  Component
    Component
      DataView

Class Ext.DataView

Package:Ext
Defined In:DataView.js
Class:DataView
Subclasses:List, Picker.Slot
Extends:Component
A mechanism for displaying data using custom layout templates and formatting. DataView uses an Ext.XTemplate as its internal templating mechanism, and is bound to an Ext.data.Store so that as the data in the store changes the view is automatically updated to reflect the changes. The view also provides built-in behavior for many common events that can occur for its contained items including itemtap, itemdoubletap, itemswipe, containertap, etc. as well as a built-in selection model. In order to use these features, an itemSelector config must be provided for the DataView to determine what nodes it will be working with.

The example below binds a DataView to a Ext.data.Store and renders it into an Ext.Panel.

var store = new Ext.data.JsonStore({
    url: 'get-images.php',
    root: 'images',
    fields: [
        'name', 'url',
        {name:'size', type: 'float'},
        {name:'lastmod', type:'date', dateFormat:'timestamp'}
    ]
});
store.load();

var tpl = new Ext.XTemplate(
    '<tpl for=".">',
        '<div class="thumb-wrap" id="{name}">',
        '<div class="thumb"><img src="{url}" title="{name}"></div>',
        '<span class="x-editable">{shortName}</span></div>',
    '</tpl>',
    '<div class="x-clear"></div>'
);

var panel = new Ext.Panel({
    id:'images-view',
    frame:true,
    width:535,
    autoHeight:true,
    collapsible:true,
    layout:'fit',
    title:'Simple DataView',

    items: new Ext.DataView({
        store: store,
        tpl: tpl,
        autoHeight:true,
        multiSelect: true,
        overClass:'x-view-over',
        itemSelector:'div.thumb-wrap',
        emptyText: 'No images to display'
    })
});
panel.render(Ext.getBody());

Config Options

Config OptionsDefined By
 centered : Boolean
Center the Component. Defaults to false.
Component
 componentCls : String
CSS Class to be added to a components root level element to give distinction to it via styling.
Component
 data : Mixed
The initial set of data to apply to the tpl to update the content area of the Component.
Component
 deferEmptyText : Boolean
True to defer emptyText being applied until the store's first load
DataView
 disabled : Boolean
Defaults to false.
Component
 disabledCls : String
CSS class to add when the Component is disabled. Defaults to 'x-item-disabled'.
Component
 draggable : Boolean
Allows the component to be dragged via the touch event.
Component
 emptyText : String
The text to display in the view when there is no data to display (defaults to '').
DataView
 floating : Boolean
Create the Component as a floating and use absolute positioning. Defaults to false.
Component
 floatingCls : Boolean
The class that is being added to this component when its floating. (defaults to x-floating)
Component
 height : Number
The height of this component in pixels.
Component
 hidden : Boolean
Defaults to false.
Component
 itemSelector : String
DataView
 monitorOrientation : Boolean
Monitor Orientation change
Component
 overItemCls : String
A CSS class to apply to each item in the view on mouseover (defaults to undefined).
DataView
 pressedCls : String
A CSS class to apply to an item on the view while it is being pressed (defaults to 'x-item-pressed').
DataView
 selectedItemCls : String
A CSS class to apply to each selected item in the view (defaults to 'x-view-selected').
DataView
 stopMaskTapEvent : Boolean
True to stop the event that fires when you click outside the floating component. Defalts to true.
Component
 store : Ext.data.Store
DataView
 styleHtmlCls : String
The class that is added to the content target when you set styleHtmlContent to true. Defaults to 'x-html'
Component
 tpl : String/Array
DataView
 trackOver : Boolean
True to enable mouseenter and mouseleave events
DataView
 triggerEvent : String
Defaults to 'singletap'. Other valid options are 'tap'
DataView
 width : Number
The width of this component in pixels.
Component

Public Properties

PropertyDefined By
 draggable : Boolean
Read-only property indicating whether or not the component can be dragged
Component
 rendered : Boolean
Read-only property indicating whether or not the component has been rendered.
Component

Public Methods

MethodDefined By

Public Events

EventDefined By