Commit 016bdaae808dd13eff780c40bb172235337c1f26
1 parent
6d616600
Exists in
master
and in
112 other branches
Fix bad rendering on granules grid
Showing
2 changed files
with
22 additions
and
12 deletions
Show diff stats
js/app/controllers/EpnTapModule.js
... | ... | @@ -163,10 +163,7 @@ Ext.define('amdaDesktop.EpnTapModule', { |
163 | 163 | send a new query and fill `granulesGrid`. |
164 | 164 | */ |
165 | 165 | onServiceSelected: function(record) { |
166 | - this.servicesStore.each(function(record) { | |
167 | - record.set('selected', false); | |
168 | - }, this); | |
169 | - record.set('selected', true); | |
166 | + this.granulesStore.selectedService = record.data.id; | |
170 | 167 | Ext.Ajax.suspendEvent('requestexception'); |
171 | 168 | Ext.Ajax.abortAll(); |
172 | 169 | var nbRes = record.get('nb_results'); |
... | ... |
js/app/views/EpnTapUI.js
... | ... | @@ -7,6 +7,7 @@ |
7 | 7 | * 24/10/2016: file creation |
8 | 8 | */ |
9 | 9 | |
10 | +Ext.require(['Ext.grid.plugin.BufferedRenderer']); | |
10 | 11 | /** |
11 | 12 | `productTypesStore`: An ExtJS Store containing the list of the different data product types defined on all granules, on |
12 | 13 | all available EPN-TAP services (defined in `generic_data/EpnTapData/metadata.json`, updated periodically with a cron |
... | ... | @@ -108,8 +109,7 @@ Ext.create('Ext.data.Store', { |
108 | 109 | {name: 'created', type: 'date', dateFormat: 'c'}, |
109 | 110 | {name: 'updated', type: 'date', dateFormat: 'c'}, |
110 | 111 | {name: 'nb_results', type: 'integer'}, |
111 | - {name: 'info', type: 'string'}, | |
112 | - {name: 'selected', type: 'boolean'} | |
112 | + {name: 'info', type: 'string'} | |
113 | 113 | ], |
114 | 114 | proxy: { |
115 | 115 | type: 'ajax', |
... | ... | @@ -145,22 +145,30 @@ selected. |
145 | 145 | - `thumbnail_url`: the thumbnail_url EPN-TAP parameter (ibid). |
146 | 146 | */ |
147 | 147 | // TODO: Add granules filter (see http://docs.sencha.com/extjs/4.0.7/#!/example/grid-filtering/grid-filter-local.html) |
148 | + | |
149 | +Ext.define('GranulesModel', { | |
150 | + extend: 'Ext.data.Model' | |
151 | + // columns are created dynamically | |
152 | +}); | |
153 | + | |
148 | 154 | Ext.create('Ext.data.Store', { |
149 | 155 | storeId: 'granulesStore', |
150 | - model: 'granulesModel', // Created dynamically | |
156 | + model: 'GranulesModel', | |
151 | 157 | buffered: true, |
152 | - leadingBufferZone: 50, | |
153 | 158 | autoload: false, |
154 | - pageSize: 50, | |
159 | + pageSize: 500, | |
160 | + leadingBufferZone: 0, | |
155 | 161 | proxy: { |
156 | 162 | type: 'ajax', |
157 | 163 | url: 'php/epntap.php', |
158 | 164 | reader: { type: 'json', root: 'data'}, |
159 | 165 | simpleSortMode: true |
160 | - }, listeners: { | |
166 | + }, | |
167 | + listeners: { | |
161 | 168 | 'beforeprefetch': function(store, operation) { |
162 | - var servicesStore = Ext.data.StoreManager.lookup('servicesStore'); | |
163 | - var service = servicesStore.getAt(servicesStore.findExact('selected', true)).data; | |
169 | + Ext.Ajax.suspendEvent('requestexception'); | |
170 | + Ext.Ajax.abortAll(); | |
171 | + var service = Ext.data.StoreManager.lookup('servicesStore').getById(store.selectedService).data; | |
164 | 172 | store.getProxy().extraParams = { |
165 | 173 | 'action': 'getGranules', |
166 | 174 | 'url': service['access_url'], |
... | ... | @@ -636,6 +644,11 @@ Ext.define('amdaUI.EpnTapUI', { |
636 | 644 | title: 'Granules', |
637 | 645 | store: Ext.data.StoreManager.lookup('granulesStore'), |
638 | 646 | flex: 4, |
647 | + plugins: { | |
648 | + ptype: 'bufferedrenderer', | |
649 | + trailingBufferZone: 20, | |
650 | + leadingBufferZone: 50 | |
651 | + }, | |
639 | 652 | columns: [] |
640 | 653 | }; |
641 | 654 | } |
... | ... |