The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

DrkCoater (6) [Avatar] Offline
#1
Hi, Jay or other fellows there, this is my first time to use this forum. I'm hoping I'm write this question in the correct place. Please move this question to wherever it's appropriate if it's not.

in chapter 15.3.2 page 368 in the book. Where it mentioned that in the plug-in class, it can have a override object which overrides the parent's class. (parentOverrides object) where in these methods the scope is the parent class which make sense. However if in one of these methods I want to access the plugin-scope, how can I do that? There are two ways I can think of doing it.
1. is access by this.plugins array, the drawback would be if the parent object has multiple plug-ins, I would need a way to identify which one is my current object?
2. inside init function, use Ext.apply(parent, this.parentOverrides) adds a extra parameter called: Ext.apply(parent, this.parentOverrides, { theCurrentPlugin: this }); This looks a bit nicer? But if I happen to write another plugin which also 'theCurrentPlugin' key, then the parent's scope will be polluted.

please advice.

thanks in advance.
Jeremy
DrkCoater (6) [Avatar] Offline
#2
Re: ExtJS in action chapter 15 question about plug-ins
Usually no reply means the questions is not clear enough. Let me just restate it to be:

1. What should be the correct way to refer to the plug-in class scope inside parentOverride methods?
2. If I want to implement a plugin feature called selectable panel. Should I implement the main panel selection logic in the plug-in class scope or within the parentOverride scope? Which one is the correct way to go?

thanks.
jesus.garcia (463) [Avatar] Offline
#3
Re: ExtJS in action chapter 15 question about plug-ins
Hi Jeremy,

I apologize for not responding sooner. To be honest, I've just been really busy authoring Sencha Touch in action along with other things.

If you have one instance of that plugin, there is nothing wrong w/ setting a property on the parent class.

For instance, with this extension: http://tdg-i.com/js/examples/ext3/extensions/windowblind/

Check out the source: http://tdg-i.com/js/examples/ext3/extensions/windowblind/Ext.plugins.TDGi.WindowBlind.js

in the init method, i set: parent.blind = this;

Hope this helps.
-Jay
DrkCoater (6) [Avatar] Offline
#4
Re: ExtJS in action chapter 15 question about plug-ins
This definitely helps.
Thanks, Jay.