Results 1 to 4 of 4

Thread: Change event in selectfield and DOM issue

  1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    103
    Vote Rating
    10
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,416
    Vote Rating
    1270
      0  

    Default

    How are you handling adding/removing items?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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
      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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,416
    Vote Rating
    1270
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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.

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
  •