-
29 May 2012 2:54 AM #1
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:
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.Code:{ "GetAllArticlesByRefList_MobileResult": [ { "ArticleDescription": "", "ArticleName": "Chaise", "ArticlePrice1": 31, "ArticleRef": "CM.A", "ArticleUnitsInStock": 100000 }, { "ArticleDescription": "", "ArticleName": "Vernis naturel", "ArticlePrice1": 91, "ArticleRef": "CB.M", "ArticleUnitsInStock": 100000 } ] }
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.
-
31 May 2012 3:49 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
How are you handling adding/removing items?
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
31 May 2012 4:19 AM #3
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
-
31 May 2012 4:20 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
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
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.


Reply With Quote