]> git.proxmox.com Git - sencha-touch.git/blob - src/examples/touchflickr/app/view/SearchListItem.js
import Sencha Touch 2.4.2 source
[sencha-touch.git] / src / examples / touchflickr / app / view / SearchListItem.js
1 /**
2 * This is a search list item for the SearchList view. It contains two items:
3 * one for the search query, and a Ext.Button which is used to delete
4 * searches. (by default this button is hidden).
5 */
6 Ext.define('Flickr.view.SearchListItem', {
7 extend: 'Ext.dataview.component.DataItem',
8 xtype : 'searchlistitem',
9
10 config: {
11 deleteButton: {
12 text : 'Delete',
13 ui : 'decline-small',
14 hidden: true
15 },
16
17 items: [
18 {
19 cls : 'search',
20 tpl : '{query}',
21 flex: 1
22 }
23 ],
24
25 layout: {
26 type : 'hbox',
27 align: 'middle'
28 }
29 },
30
31 /**
32 * Returns an instance of a Ext.Button based on the {@link #deleteButton} configuration
33 */
34 applyDeleteButton: function(config) {
35 return Ext.factory(config, Ext.Button, this.getDeleteButton());
36 },
37
38 /**
39 * When the {@link #deleteButton} configuration is updated, add it to this item.
40 */
41 updateDeleteButton: function(newDeleteButton) {
42 if (newDeleteButton) {
43 this.add(newDeleteButton);
44 }
45 }
46 });