Properties Methods Events Config Options Direct Link
Observable
  Component
    BoxComponent
      DataView

Class CQ.Ext.DataView

Package:CQ.Ext
Class:DataView
Subclasses:ListView
Extends:CQ.Ext.BoxComponent
Clientlib:cq.widgets
xtype:dataview
A mechanism for displaying data using custom layout templates and formatting. DataView uses an CQ.Ext.XTemplate as its internal templating mechanism, and is bound to an CQ.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 click, doubleclick, mouseover, mouseout, 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 CQ.Ext.data.Store and renders it into an CQ.Ext.Panel.

var store = new CQ.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 CQ.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 CQ.Ext.Panel({
    id:'images-view',
    frame:true,
    width:535,
    autoHeight:true,
    collapsible:true,
    layout:'fit',
    title:'Simple DataView',

    items: new CQ.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(document.body);

Config Options

Config Options Defined By
  allowDomMove : Boolean
Whether the component can move the Dom node when rendering (defaults to true).
Component
  deferEmptyText : Boolean
True to defer emptyText being applied until the store's first load
DataView
  disabled : Boolean
Render this component disabled (default is false).
Component
  disabledClass : String
CSS class added to the component when it is disabled (defaults to 'x-item-disabled').
Component
  emptyText : String
The text to display in the view when there is no data to display (defaults to '').
DataView
  overClass : String
A CSS class to apply to each item in the view on mouseover (defaults to undefined).
DataView
  pageX : Number
The page level x coordinate for this component if contained within a positioning container.
BoxComponent
  pageY : Number
The page level y coordinate for this component if contained within a positioning container.
BoxComponent
  selectedClass : String
A CSS class to apply to each selected item in the view (defaults to 'x-view-selected').
DataView
  trackOver : Boolean
True to enable mouseenter and mouseleave events
DataView
  x : Number
The local x (left) coordinate for this component if contained within a positioning container.
BoxComponent
  y : Number
The local y (top) coordinate for this component if contained within a positioning container.
BoxComponent

Public Properties

Property Defined By
  disabled : Boolean
True if this component is disabled. Read-only.
Component
  hidden : Boolean
True if this component is hidden. Read-only.
Component
  initialConfig : Object
This Component's initial configuration specification. Read-only.
Component
  refOwner : CQ.Ext.Container The
Component
  rendered : Boolean
True if this component has been rendered. Read-only.
Component
  setStore : Object
Changes the data store bound to this view and refreshes it. (deprecated in favor of bindStore)
DataView

Public Methods

Method Defined By

Public Events

Event Defined By