]> git.proxmox.com Git - extjs.git/blame - extjs/examples/modern/touchtomatoes/app/view/MovieSearch.js
add extjs 6.0.1 sources
[extjs.git] / extjs / examples / modern / touchtomatoes / app / view / MovieSearch.js
CommitLineData
6527f429
DM
1Ext.define('TouchTomatoes.view.MovieSearch', {\r
2 extend: 'TouchTomatoes.view.MoviesListView',\r
3 xtype: 'moviesearch',\r
4 requires: [\r
5 'Ext.Toolbar', 'Ext.field.Text', 'Ext.field.Search', 'Ext.dataview.List',\r
6 'Ext.form.Panel', 'Ext.plugin.ListPaging',\r
7 'TouchTomatoes.proxy.RottenTomatoes', 'TouchTomatoes.model.Movie'],\r
8 config: {\r
9 enablePaging: true,\r
10 autoLoad: false,\r
11 cls: "moviesearch",\r
12 header: [\r
13 {\r
14 iconCls: "fa fa-bars",\r
15 ui: "plain",\r
16 docked: "left"\r
17 },\r
18 {\r
19 xtype: "formpanel",\r
20 scrollable: null,\r
21 items: [\r
22 {\r
23 xtype: 'searchfield',\r
24 placeHolder: 'Movie Search..'\r
25 }\r
26 ]\r
27 }\r
28 ]\r
29 },\r
30 getStore: function() {\r
31 if (!this._store) {\r
32 this.callParent();\r
33 this._store.setRemoteFilter(true);\r
34\r
35 //Intercept the load function and short circuit it when there is no query\r
36 this._store.load = Ext.Function.createInterceptor(this._store.load, function() {\r
37 var filters = this.getFilters(),\r
38 len = filters.length,\r
39 filter;\r
40 for (var i = 0; i < len; i++) {\r
41 filter = filters.getAt(i);\r
42 if (filter.getId() === "query" && filter.getValue().length > 0) return true;\r
43 }\r
44 return false;\r
45 }, this._store)\r
46 }\r
47 return this._store;\r
48 }\r
49});\r