Results 1 to 5 of 5

Thread: Element added to DOM event (ST2-B3)

  1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    46
    Answers
    1
    Vote Rating
    0
      0  

    Default 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
      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
    19
      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
      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
      0  

    Default

    Bump

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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •