Upgrade to ExtJS 4.0.2 - Released 06/09/2011
[extjs.git] / docs / app / view / search / Dropdown.js
1 /**
2  * Renders search results list.
3  */
4 Ext.define('Docs.view.search.Dropdown', {
5     extend: 'Ext.view.View',
6     alias: 'widget.searchdropdown',
7
8     floating: true,
9     autoShow: false,
10     autoRender: true,
11     toFrontOnShow: true,
12     focusOnToFront: false,
13
14     store: 'Search',
15
16     id: 'search-dropdown',
17     overItemCls:'x-view-over',
18     trackOver: true,
19     itemSelector:'div.item',
20     singleSelect: true,
21
22     initComponent: function() {
23         this.tpl = new Ext.XTemplate(
24             '<tpl for=".">',
25                 '<div class="item {type}">',
26                     '<div class="title">{member}</div>',
27                     '<div class="class">{cls}</div>',
28                 '</div>',
29             '</tpl>',
30             '<div class="total">{[values.length]} of {[this.getTotal()]}</div>',
31             {
32                 getTotal: Ext.bind(this.getTotal, this)
33             }
34         );
35         this.callParent(arguments);
36     },
37
38     /**
39      * Sets number of total search results
40      * @param {Number} total
41      */
42     setTotal: function(total) {
43         this.total = total;
44     },
45
46     /**
47      * Returns number of total search results
48      * @return {Number}
49      */
50     getTotal: function() {
51         return this.total;
52     }
53 });