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 * An internally used DataView for {@link Ext.form.field.ComboBox ComboBox}.
18 Ext.define('Ext.view.BoundList', {
19 extend: 'Ext.view.View',
20 alias: 'widget.boundlist',
21 alternateClassName: 'Ext.BoundList',
22 requires: ['Ext.layout.component.BoundList', 'Ext.toolbar.Paging'],
25 * @cfg {Number} pageSize
26 * If greater than `0`, a {@link Ext.toolbar.Paging} is displayed at the bottom of the list and store
27 * queries will execute with page {@link Ext.data.Operation#start start} and
28 * {@link Ext.data.Operation#limit limit} parameters. Defaults to `0`.
33 * @property {Ext.toolbar.Paging} pagingToolbar
34 * A reference to the PagingToolbar instance in this view. Only populated if {@link #pageSize} is greater
35 * than zero and the BoundList has been rendered.
40 baseCls: Ext.baseCSSPrefix + 'boundlist',
41 itemCls: Ext.baseCSSPrefix + 'boundlist-item',
49 componentLayout: 'boundlist',
51 renderTpl: ['<div id="{id}-listEl" class="list-ct"></div>'],
53 initComponent: function() {
58 me.selectedItemCls = baseCls + '-selected';
59 me.overItemCls = baseCls + '-item-over';
60 me.itemSelector = "." + itemCls;
63 me.addCls(baseCls + '-floating');
67 // should be setting aria-posinset based on entire set of data
69 me.tpl = Ext.create('Ext.XTemplate',
71 '<li role="option" class="' + itemCls + '">' + me.getInnerTpl(me.displayField) + '</li>',
74 } else if (Ext.isString(me.tpl)) {
75 me.tpl = Ext.create('Ext.XTemplate', me.tpl);
79 me.pagingToolbar = me.createPagingToolbar();
84 me.addChildEls('listEl');
87 createPagingToolbar: function() {
88 return Ext.widget('pagingtoolbar', {
89 pageSize: this.pageSize,
95 onRender: function() {
97 toolbar = me.pagingToolbar;
98 me.callParent(arguments);
100 toolbar.render(me.el);
104 bindStore : function(store, initial) {
106 toolbar = me.pagingToolbar;
107 me.callParent(arguments);
109 toolbar.bindStore(store, initial);
113 getTargetEl: function() {
114 return this.listEl || this.el;
117 getInnerTpl: function(displayField) {
118 return '{' + displayField + '}';
121 refresh: function() {
124 if (me.isVisible()) {
126 me.doComponentLayout();
131 initAria: function() {
134 var selModel = this.getSelectionModel(),
135 mode = selModel.getSelectionMode(),
136 actionEl = this.getActionEl();
138 // TODO: subscribe to mode changes or allow the selModel to manipulate this attribute.
139 if (mode !== 'SINGLE') {
140 actionEl.dom.setAttribute('aria-multiselectable', true);
144 onDestroy: function() {
145 Ext.destroyMembers(this, 'pagingToolbar', 'listEl');