]>
git.proxmox.com Git - sencha-touch.git/blob - src/examples/kiva/app/controller/Loans.js
2 * @class Kiva.controller.Loans
3 * @extends Ext.app.Controller
5 * The only controller in this simple application - this simply sets up the fullscreen viewport panel
6 * and renders a detailed overlay whenever a Loan is tapped on.
8 Ext
.define('Kiva.controller.Loans', {
9 extend
: 'Ext.app.Controller',
12 profile
: Ext
.os
.deviceType
.toLowerCase(),
16 loansList
: 'loanslist',
17 loanFilter
: 'loanfilter',
18 searchField
: 'searchfield',
19 refreshButton
: 'button[iconCls=refresh]'
27 hideanimationstart
: 'onDetailHideAnimationStart'
33 change
: 'onSelectChange'
35 'button[iconCls=refresh]': {
36 tap
: 'onRefreshButtonTap'
42 Ext
.getStore('Loans').on({
45 beforeload
: this.onBeforeStoreLoad
,
46 load
: this.onStoreLoad
50 onListTap: function(list
, loan
) {
52 this.view
= Ext
.create('Kiva.view.Detail');
58 if (this.getProfile() == "phone") {
60 view
.setHeight('85%');
65 if (!view
.getParent()) {
66 Ext
.Viewport
.add(view
);
72 onSearch: function(field
) {
78 onSelectChange: function(field
) {
79 if (!field
.initialized
) {
84 config
[field
.getName()] = field
.getValue();
85 this.doFilter(config
);
88 onDetailHideAnimationStart: function() {
89 this.getLoansList().deselectAll();
92 onRefreshButtonTap: function() {
93 var store
= Ext
.getStore('Loans'),
94 hasValue
= Boolean(this.getSearchField().getValue().length
);
103 onBeforeStoreLoad: function() {
104 this.getRefreshButton().setDisabled(true);
107 onStoreLoad: function() {
108 this.getRefreshButton().setDisabled(false);
113 * Listener for the 'filter' event fired by the listView set up in the 'list' action. This simply
114 * gets the form values that the user wants to filter on and tells the Store to filter using them.
116 doFilter: function(values
) {
117 var store
= Ext
.getStore('Loans'),
120 Ext
.iterate(values
, function(field
, value
) {
127 store
.clearFilter(true);
128 store
.filter(filters
);