]> git.proxmox.com Git - pmg-gui.git/commitdiff
SpamInfoGrid.js - use single store object
authorDietmar Maurer <dietmar@proxmox.com>
Fri, 29 Sep 2017 06:02:02 +0000 (08:02 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 29 Sep 2017 06:02:02 +0000 (08:02 +0200)
And only set/change url.

js/SpamInfoGrid.js

index 5939804a874422b24116af561fe5d46cbdeca4f7..f7b60b8cb8f3104b83afe3c4f5569dd0ef3dfbc3 100644 (file)
@@ -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'),