1. #1
    Ext JS Premium Member
    Join Date
    Oct 2011
    Posts
    54
    Vote Rating
    0
    pm100 is on a distinguished road

      0  

    Default tree behavior change for dynamic loaded child nodes

    tree behavior change for dynamic loaded child nodes


    I have a tree. Root node not shown. At construct time it calls the store to load the root's children (there is 1 of them). That child has no children but is marked !leaf.

    in 4.0.7
    A plus appears next to the single node. When I click the plus the store is called to load the children (if any)

    in 4.1
    no plus appears next to it so its children never get loaded

  2. #2
    Ext JS Premium Member
    Join Date
    Oct 2011
    Posts
    54
    Vote Rating
    0
    pm100 is on a distinguished road

      0  

    Default


    I have worked out why this is.

    when the first child is added it is marked as phantom. And hence appendChild marks is as 'loaded'

    When isExpandable is called the answer is false because isLoaded is true and it has no children.

    The node is marked as phantom because I didnt supply an id for it. This is the new bit. Why a auto-id node should be 'phantom' I dont know.

  3. #3

  4. #4
    Sencha - Ext JS Dev Team Phil Guerrant's Avatar
    Join Date
    May 2011
    Location
    Colorado
    Posts
    321
    Vote Rating
    87
    Phil Guerrant is just really nice Phil Guerrant is just really nice Phil Guerrant is just really nice Phil Guerrant is just really nice Phil Guerrant is just really nice

      0  

    Default


    An appended phantom record is marked as "loaded" intentionally because the "loaded" field determines whether or not the proxy will attempt to load the record's children when it is expanded. Since a newly created phantom record should not yet have any children stored on the server, we set "loaded" to true when it is appended so that it does not attempt to load when expanded.

    I can't imagine a case where you would need to load children for a phantom record. Are you creating a record client-side that is assumed to have children server-side? If so, you could either assign it an id when it is created, or set its "loaded" field back to false after appending it. I'm not sure either solution is really desirable. Could you provide more details as to exactly what you're trying to accomplish here?
    Phil Guerrant
    Ext JS - Development Team

  5. #5
    Ext JS Premium Member
    Join Date
    Oct 2011
    Posts
    54
    Vote Rating
    0
    pm100 is on a distinguished road

      0  

    Default


    You decided that my record was phantom simply because I didnt set its ID when I created it. This is an interface change

    I used to go

    var rec = Ext.Create("my record class")
    rec.set('id', <id>)

    This worked fine in 4.0.7

    Now I have to go

    var rec = Ext.Create("my record class", {id: <id>});

    Its OK , but it was surprising (and took a long time to debug)

Thread Participants: 2