Comments (10)
Do you have a code sample? I'm not sure how you mean by hooking up the closed event after onCreate
.
I've tried the closed event both inside the onCreate
and with the resulting panel from wcDocker.addPanel
and it worked fine for me.
from wcdocker.
This is the simulated code sample. The actual code is bit complex to list down.
function registerRender(self) {
myDocker.registerPanelType(self.moduleName, {
isPersistent: false, // explicit set to false. PERSISTENT_* event handlers not invoked
onCreate: function (panel) {
setTimeout(function () {
panel.on(wcDocker.EVENT.CLOSED, function (data) {
// THIS IS NOT CALLED
alert('CLOSED');
});
// These handlers are invoked
panel.on(wcDocker.EVENT.PERSISTENT_OPENED, function (data) {
alert('PERSISTENT_OPENED');
});
panel.on(wcDocker.EVENT.PERSISTENT_CLOSED, function (data) {
alert('PERSISTENT_CLOSED');
});
}, 10);
self.moduleObject.onRender(panel);
}
});
}
from wcdocker.
You may have to provide more; Using the code above, I've tried closing that panel when it was both initialized as part of the initial layout, when I manually created and closed it, and when it is both floating and docked.
It gave me the CLOSED
alert every time.
I couldn't copy the self.moduleObject.onRender(panel);
part though.
from wcdocker.
Just wanted to give you a ping and see if you are still having this problem.
from wcdocker.
Unfortunately yes, but i patched it. How it occurs, is still unknown to me. Maybe you can help in this case.
But I can show you why it occurs.
in panel.js
__trigger: function (eventType, data) {
if (!eventType) {
return false;
}
if (this._events[eventType]) {
/* NOTE: Temp fix for github #57 bug*/
for (var i = this._events[eventType].length - 1; i >= 0; --i) {
this._events[eventType][i].call(this, data);
}
//for (var i = 0; i < this._events[eventType].length; ++i) {
// this._events[eventType][i].call(this, data);
//}
}
},
At runtime the _events.length
is 2
. One is the panel handler and other that I added.
Now when the panel is closed the first handler removes itself from this array and length is updated to 1. This prevents my handler from being invoked.
I reversed the array and my handler is invoked first.
Hope that I explained the "why". If you can look into it why it is this way and generate the scenario at your end, that will be great.
from wcdocker.
Ahh, that explains it! The panel itself does not use the closed event. Most likely you are using either a tabframe, iframe, or splitter inside your panel. These will register a closed event, and during that event it will un-register its own events causing your problem!
I've been able to reproduce your case now, and will have a fix for it in a few minutes.
from wcdocker.
Please try this latest update and let me know if it fixed your problem.
from wcdocker.
Yes, it's fixed now. Thanks.
But can you tell me the scenario that reproduces the issue?
from wcdocker.
All you have to do is create either a wcTabFrame
or a wcIFrame
in your panel first before you register your CLOSED
event handler. The tab frame and iframe both register their own CLOSED
event handler onto your panel. When they are triggered, they clean themselves up by un-registering all the events they've added, among other things.
from wcdocker.
Ok, got it.
from wcdocker.
Related Issues (20)
- does wcDocker have a destroy-function? HOT 8
- Can wcDocker "just" restore the positions/dims of panels without re-instantiation? HOT 5
- Using 'Panel Creation Elements' breaks creation of panels via context menu
- Docker panel resize HOT 1
- Docker is in infinite loop HOT 2
- Cannot move the stacked Iframe panel into the browser tab. HOT 1
- mobile device events
- Embedded wcDocker instance or otherwise constraining panels to one layout HOT 3
- Can I use wcDocker with angular2? HOT 2
- Provide dynamic options via addPanel HOT 3
- Improved forked version available - bug fixes and performance
- PopOut Browser
- restoring a layout refreshes iframes HOT 1
- Scroll position resets after resize panel HOT 1
- Using moveable(false) causes Browser window hang HOT 5
- wcDocker Frame do not load URL when we use jQuery v.3.3.1
- Any light Theme?
- How do I prevent a panel from resizing?
- Is it possible to localize the context menu?
- Localization
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wcdocker.