Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear partition button problem #7

Open
davidpede opened this issue Jan 22, 2016 · 3 comments
Open

Clear partition button problem #7

davidpede opened this issue Jan 22, 2016 · 3 comments
Assignees

Comments

@davidpede
Copy link

Great extra, I use it a lot!

Have an anoying issue with the clear partition menu button though.

  1. First time you click the custom button, MODX console opens and partition clears as expected.
  2. Second click, the MODX console doesn't open, partition doesn't clear and there's a js error 'TypeError: b.dom is undefined' in ext-all.js
  3. All further times you click the button nothing happens and this js error is thrown 'TypeError: this.manager is undefined'

To get the button working again you have to force refresh the manager page.

My menu button code as the docs:

var topic = '/getcache/cache/partition/refresh/navMenu/';
if (this.console == null || this.console == undefined) {
    this.console = MODx.load({
       xtype: 'modx-console'
       ,register: 'mgr'
       ,topic: topic
       ,show_filename: 0
    });
} else {
    this.console.setRegister('mgr', topic);
}
this.console.show(Ext.getBody());

MODx.Ajax.request({
    url: MODx.config.assets_url+'components/getcache/connector.php'
    ,params: { action: 'cache/partition/refresh', partitions: 'navMenu', register: 'mgr' , topic: topic }
    ,listeners: {
        'success':{fn:function() {
            this.console.fireEvent('complete');
        },scope:this}
    }
});
return false;
@davidpede
Copy link
Author

I tried removing the 'if' check and it seemed to solve it:

var topic = '/getcache/cache/partition/refresh/navMenu/';

this.console = MODx.load({
  xtype: 'modx-console'
  ,register: 'mgr'
  ,topic: topic
  ,show_filename: 0
  });

this.console.show(Ext.getBody());

MODx.Ajax.request({
  url: MODx.config.assets_url+'components/getcache/connector.php'
  ,params: { action: 'cache/partition/refresh', partitions: 'navMenu', register: 'mgr' , topic: topic }
  ,listeners: {
    'success':{fn:function() {
      this.console.fireEvent('complete');
    },scope:this}
  }
});
return false;

Are these changes likely to cause problems or is there a better way of doing the 'if' check?

@opengeek opengeek self-assigned this Aug 4, 2016
@opengeek
Copy link
Owner

opengeek commented Aug 4, 2016

To be honest, I'm not sure why the if check is breaking this. But I have updated the wiki with a version that works, without said conditional. See Refresh Custom Cache Partitions.

@jenswittmann
Copy link

jenswittmann commented Oct 30, 2020

I had the some problem today. Adding the Script without the if statement also does'nt work in MODX 2.7.3.

My solution is now this and it also get reopened:

var topic = '/getcache/cache/partition/refresh/global_cache/';

this.console = MODx.load({
    xtype: 'modx-console'
    ,register: 'mgr'
    ,topic: topic
    ,show_filename: 0
});

this.console.show(Ext.getBody());MODx.Ajax.request({
    url: MODx.config.assets_url+'components/getcache/connector.php'
    ,params: { action: 'cache/partition/refresh', partitions: 'global_cache', register: 'mgr' , topic: topic }
    ,listeners: { }
});

return false;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants