-
18 Feb 2012 2:06 AM #1
Unanswered: Element added to DOM event (ST2-B3)
Unanswered: Element added to DOM event (ST2-B3)
I'm using the RaphaelJs library to create a SVG drawing in my Sencha application. The application is quite large and I'm creating and destroying components as I go.
I thought that the Show event would fire after the element was added to the DOM. Unfortunately this isn't the case. What is the proper event to listen to?
I've read about the painted event, but that isn't working either.
-
18 Feb 2012 3:19 AM #2
My workaround right now is adding this to the view:
So that I can listen to the application event from the Controller.Code:listeners: { painted: { fn: function () { // fire application event }, element: 'element' } }
But I'd prefer a way to do this properly from the Controller.
-
18 Feb 2012 9:48 AM #3Sencha - Sencha Touch Dev Team
- Join Date
- Mar 2007
- Location
- Redwood City, California
- Posts
- 3,653
- Vote Rating
- 14
- Answers
- 17
How are you adding the SVG elements in?
-
18 Feb 2012 10:52 PM #4
I'm using RaphaelJS, it starts with the Raphael call:
RaphaelJS will throw a javascript error, because it can't retrieve the x and y positions of the parent container. Which makes sense because it hasn't been added to the DOM yet.Code:if (!this.svg) this.svg = Raphael(this.getId(), 1000, 570);
After that I do calls on this.svg to create SVG shapes.
-
21 Feb 2012 8:03 AM #5
Bump
Jamie, is there a better way?
I'd prefer a controller-only solution


Reply With Quote