1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    46
    Answers
    1
    Vote Rating
    0
    Zyphrax is on a distinguished road

      0  

    Default 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.

  2. #2
    Sencha User
    Join Date
    Sep 2011
    Posts
    46
    Answers
    1
    Vote Rating
    0
    Zyphrax is on a distinguished road

      0  

    Default


    My workaround right now is adding this to the view:

    Code:
     listeners: {
       painted: {
        fn: function () {
         // fire application event
        },
        element: 'element'
       }
      }
    So that I can listen to the application event from the Controller.
    But I'd prefer a way to do this properly from the Controller.

  3. #3
    Sencha User Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661
    Answers
    17
    Vote Rating
    18
    Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough

      0  

    Default


    How are you adding the SVG elements in?

    Sencha Inc

    Jamie Avins

    @jamieavins

  4. #4
    Sencha User
    Join Date
    Sep 2011
    Posts
    46
    Answers
    1
    Vote Rating
    0
    Zyphrax is on a distinguished road

      0  

    Default


    I'm using RaphaelJS, it starts with the Raphael call:

    Code:
    if (!this.svg)
       this.svg = Raphael(this.getId(), 1000, 570);
    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.

    After that I do calls on this.svg to create SVG shapes.

  5. #5
    Sencha User
    Join Date
    Sep 2011
    Posts
    46
    Answers
    1
    Vote Rating
    0
    Zyphrax is on a distinguished road

      0  

    Default


    Bump

    Jamie, is there a better way?
    I'd prefer a controller-only solution

Thread Participants: 1

Tags for this Thread