1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    103
    Vote Rating
    10
    pepperseb is on a distinguished road

      0  

    Default Change event in selectfield and DOM issue

    Change event in selectfield and DOM issue


    Hello,

    I don't know if this is a bug

    1) I have a view with a template bind with a JSON that looks like this:

    Code:
    {
        "GetAllArticlesByRefList_MobileResult": [
            {
                "ArticleDescription": "",
                "ArticleName": "Chaise",
                "ArticlePrice1": 31,
                "ArticleRef": "CM.A",
                "ArticleUnitsInStock": 100000
            },
            {
                "ArticleDescription": "",
                "ArticleName": "Vernis naturel",
                "ArticlePrice1": 91,
                "ArticleRef": "CB.M",
                "ArticleUnitsInStock": 100000
            }
        ]
    }
    Anyway, I display one article at the same time in my template and give the opportunity to select another article thanks to a selectfield. Then I listen to the change event to set new data to my template.

    The problem is that, each time I pick an item and inspect the DOM, a new node is created.

    I was expecting that there's only one node that's being overwrite to keep the DOM as light as possible.

    2) If this is not a bug, is there a way to clean the DOM in order to keep only the new data/node?

    Thanks.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,330
    Vote Rating
    847
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    How are you handling adding/removing items?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    103
    Vote Rating
    10
    pepperseb is on a distinguished road

      0  

    Default


    I can't reproduce the problem because I change the way of handling/displaying element. It might be a misuse from myself.

    However, I'm quite sure there's still a bug with the change event in selectfield: the event is fired when store loads. Please look at
    http://www.sencha.com/forum/showthre...d-change-event

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,330
    Vote Rating
    847
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    That is due to the select field will always have a value. If one isn't present it will set the value to the first record in the store.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1

Tags for this Thread