1. #1
    Sencha User
    Join Date
    Nov 2010
    Location
    Brest (France)
    Posts
    7
    Vote Rating
    0
    neolitec is on a distinguished road

      0  

    Question Unanswered: TreePanel: BeforeExpand event on element that has no child

    Unanswered: TreePanel: BeforeExpand event on element that has no child


    Hello,

    I have a TreePanel with some static elements and other elements that must be dynamically loaded.
    So I want to detect the BeforeExpand event on each parent in order to load their children.
    When I try to expand the element, BeforeExpand is not fired and the expand pics disappears (like the folder icon).

    Why?

    At the moment, the OnClick event is detected to load the children. And I noticed that after the OnClick, BeforeExpand can be fired.
    I understand now that BeforeExpand can not be fired if the element that trigger it has no child. Why it works that way?

    This does not suit me at all! Is there another solution?

    Thx

  2. #2
    Sencha User
    Join Date
    Nov 2008
    Location
    Vienna - Austria
    Posts
    867
    Answers
    9
    Vote Rating
    1
    micgala is on a distinguished road

      0  

    Default


    Hi.

    In your tree class, you can try to override the hasChildren method.
    That method will return true if the parent has children.

    If you want it to return true by any other means, override it and add what you need.

    Hope that helps you.

    Regards,
    Michel.

  3. #3
    Sencha User
    Join Date
    Nov 2010
    Location
    Brest (France)
    Posts
    7
    Vote Rating
    0
    neolitec is on a distinguished road

      0  

    Default


    Hi micgala,

    Thank for your answer, indeed, i've already override hasChildren method and it works nice :
    I have an element with a folder icon, but without children (they have been detected as parent element by my hasChildren overriden method).
    So I can expand it (I see the expand icon).

    When I try to expand it, I noticed that BeforeExpand is not fired (I need it to load the children).
    And just after, my element is repainted and seems not to be detected as a parent (folder and expand icon disappear).

    That's why I said "I understand now that BeforeExpand can not be fired if the element that trigger it has no child".

  4. #4
    Sencha User
    Join Date
    Jul 2010
    Posts
    15
    Vote Rating
    0
    hulseware is on a distinguished road

      0  

    Default Add a Dummy Child to the tree node that needs future expansion

    Add a Dummy Child to the tree node that needs future expansion


    I had a similar problem - you don't get the expander on the tree node without a child. So on those nodes that I know need future expansion, I add a child node with the name field of Expanding... and have a hidden attribute in the tree store that indicates if the query has occurred yet (which is set on the node that needs expanding, not on the Expanding... node). Now I have an expander icon on the node in the tree. When I click the expander, the tree visually expands, showing the Expanding... node, then the BeforeExpand is fired. I look at the node queried field. If it is not set to true, I do the server query and mask the tree to prevent other operations. When the storeDataChanged method runs later, I remove the Expanding... child, replace it with the query results, and then unmask the tree.

  5. #5
    Sencha User
    Join Date
    Nov 2010
    Location
    Brest (France)
    Posts
    7
    Vote Rating
    0
    neolitec is on a distinguished road

      0  

    Default


    Yes, I finally solved the problem excatly the same way.
    But in my opinion there must/should be a better method to do it... Only the loading icon should be visible.

Thread Participants: 2

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."