From: Dietmar Maurer Date: Fri, 29 Sep 2017 06:02:02 +0000 (+0200) Subject: SpamInfoGrid.js - use single store object X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=c811498512de6924b3302bb054bf2e4b33baf657;p=pmg-gui.git SpamInfoGrid.js - use single store object And only set/change url. --- diff --git a/js/SpamInfoGrid.js b/js/SpamInfoGrid.js index 5939804..f7b60b8 100644 --- a/js/SpamInfoGrid.js +++ b/js/SpamInfoGrid.js @@ -2,23 +2,24 @@ Ext.define('PMG.grid.SpamInfoGrid',{ extend: 'Ext.grid.GridPanel', xtype: 'pmgSpamInfoGrid', + store: { + autoDestroy: true, + fields: [ 'desc', 'name', { type: 'number', name: 'score' } ], + proxy: { + type: 'proxmox', + root: 'data.spaminfo' + } + }, + setID: function(rec) { var me = this; if (!rec || !rec.data || !rec.data.id) { me.getStore().removeAll(); return; } - - me.setStore({ - autoLoad: true, - autoDestroy: true, - fields: [ 'desc', 'name', { type: 'number', name: 'score' } ], - proxy: { - type: 'proxmox', - url: '/api2/json/quarantine/content?id='+rec.data.id, - root: 'data.spaminfo' - } - }); + var url = '/api2/json/quarantine/content?id=' + rec.data.id; + me.store.proxy.setUrl(url); + me.store.load(); }, emptyText: gettext('No Spam Info'),