3 This file is part of Ext JS 4
5 Copyright (c) 2011 Sencha Inc
7 Contact: http://www.sencha.com/contact
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
16 * @class Ext.view.BoundList
17 * @extends Ext.view.View
18 * An internal used DataView for ComboBox, MultiSelect and ItemSelector.
20 Ext.define('Ext.view.BoundList', {
21 extend: 'Ext.view.View',
22 alias: 'widget.boundlist',
23 alternateClassName: 'Ext.BoundList',
24 requires: ['Ext.layout.component.BoundList', 'Ext.toolbar.Paging'],
27 * @cfg {Number} pageSize If greater than <tt>0</tt>, a {@link Ext.toolbar.Paging} is displayed at the
28 * bottom of the list and store queries will execute with page start and
29 * {@link Ext.toolbar.Paging#pageSize limit} parameters.
34 * @property pagingToolbar
35 * @type {Ext.toolbar.Paging}
36 * A reference to the PagingToolbar instance in this view. Only populated if {@link #pageSize} is greater
37 * than zero and the BoundList has been rendered.
42 baseCls: Ext.baseCSSPrefix + 'boundlist',
50 componentLayout: 'boundlist',
52 renderTpl: ['<div class="list-ct"></div>'],
54 initComponent: function() {
57 itemCls = baseCls + '-item';
59 me.selectedItemCls = baseCls + '-selected';
60 me.overItemCls = baseCls + '-item-over';
61 me.itemSelector = "." + itemCls;
64 me.addCls(baseCls + '-floating');
68 // should be setting aria-posinset based on entire set of data
70 me.tpl = Ext.create('Ext.XTemplate',
72 '<li role="option" class="' + itemCls + '">' + me.getInnerTpl(me.displayField) + '</li>',
75 } else if (Ext.isString(me.tpl)) {
76 me.tpl = Ext.create('Ext.XTemplate', me.tpl);
80 me.pagingToolbar = me.createPagingToolbar();
85 Ext.applyIf(me.renderSelectors, {
90 createPagingToolbar: function() {
91 return Ext.widget('pagingtoolbar', {
92 pageSize: this.pageSize,
98 onRender: function() {
100 toolbar = me.pagingToolbar;
101 me.callParent(arguments);
103 toolbar.render(me.el);
107 bindStore : function(store, initial) {
109 toolbar = me.pagingToolbar;
110 me.callParent(arguments);
112 toolbar.bindStore(store, initial);
116 getTargetEl: function() {
117 return this.listEl || this.el;
120 getInnerTpl: function(displayField) {
121 return '{' + displayField + '}';
124 refresh: function() {
127 if (me.isVisible()) {
129 me.doComponentLayout();
134 initAria: function() {
137 var selModel = this.getSelectionModel(),
138 mode = selModel.getSelectionMode(),
139 actionEl = this.getActionEl();
141 // TODO: subscribe to mode changes or allow the selModel to manipulate this attribute.
142 if (mode !== 'SINGLE') {
143 actionEl.dom.setAttribute('aria-multiselectable', true);
147 onDestroy: function() {
148 Ext.destroyMembers(this, 'pagingToolbar', 'listEl');