-
9 May 2012 7:40 AM #1
Disclosure icons in Ext.List are not displayed correctly after loading new data
Disclosure icons in Ext.List are not displayed correctly after loading new data
REQUIRED INFORMATION
Ext version tested:- Sencha 2.0.1
Browser versions tested against:- Chrome 18
DOCTYPE tested against:- HTML5
Description:
We use the disclosure field in a model to control the visibility of the disclosure icon for each row in an Ext.List. This works with the initial data only. If the data of the store is changed, the disclosure icons do not match to the disclosure field. The problem is deterministic - often the situation is the opposite of the expected result.
Steps to reproduce the problem:
See the test case. Click on the button at the top to load new data and see the problem.
The items with (>) should have a disclosure icon, otherwise not.
The result that was expected:
The disclosure icons are displayed exactly for the records, where disclosure = true.
The result that occurs instead:
The disclosure icons are displayed randomly.
Test Case:
This is only a slightly changed version of the second example of the Ext.List documentation.
Code:Ext.define('Contact', { extend : 'Ext.data.Model', config : { fields : ['firstName', 'lastName', 'disclosure'] } }); var store = Ext.create('Ext.data.Store', { model : 'Contact', sorters : 'lastName', grouper : { groupFn : function(record) { return record.get('lastName')[0]; } }, data : [{ firstName : 'Tommy', lastName : 'Maintz', disclosure : true }, { firstName : 'Rob', lastName : 'Dougan', disclosure : false }, { firstName : 'Ed', lastName : 'Spencer', disclosure : false }, { firstName : 'Jamie', lastName : 'Avins', disclosure : false }, { firstName : 'Aaron', lastName : 'Conran', disclosure : true }, { firstName : 'Dave', lastName : 'Kaneda', disclosure : false }, { firstName : 'Jacky', lastName : 'Nguyen', disclosure : true }, { firstName : 'Abraham', lastName : 'Elias', disclosure : false }, { firstName : 'Jay', lastName : 'Robinson', disclosure : false }, { firstName : 'Nigel', lastName : 'White', disclosure : true }, { firstName : 'Don', lastName : 'Griffin', disclosure : false }, { firstName : 'Nico', lastName : 'Ferrero', disclosure : false }, { firstName : 'Jason', lastName : 'Johnston', disclosure : false }] }); Ext.create('Ext.List', { fullscreen : true, itemTpl : '<div class="contact">{firstName} <strong>{lastName}</strong><tpl if="disclosure"> ( > )</tpl></div>', store : store, grouped : true, onItemDisclosure : function() { alert('Disclosure click'); }, items : [{ xtype : 'button', text : 'load different data', handler : function() { store.setData([{ firstName : 'Heiner', lastName : 'Mueller', disclosure : false }, { firstName : 'Peter', lastName : 'Meier', disclosure : true }, { firstName : 'Frank', lastName : 'Meiser', disclosure : false }]) } }] });
HELPFUL INFORMATION
Debugging already done:- none
Possible fix:- not provided
Regards Farion
-
9 May 2012 8:25 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,641
- Vote Rating
- 434
Thanks for the report.
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.
-
14 Jun 2012 8:27 AM #3Sencha - Sencha Touch Dev Team
- Join Date
- Mar 2007
- Location
- Redwood City, California
- Posts
- 3,652
- Vote Rating
- 14
This has been fixed for the next release. The following override should resolve the issue, please let us know if you still have issues:
Code:Ext.define('Overrides.dataview.element.List', { override: 'Ext.dataview.element.List', updateListItem: function(record, item) { var me = this, dataview = me.dataview, extItem = Ext.fly(item), innerItem = extItem.down(me.labelClsCache, true), data = dataview.prepareData(record.getData(true), dataview.getStore().indexOf(record), record), disclosureProperty = dataview.getDisclosureProperty(), hasDisclosureProperty = data && data.hasOwnProperty(disclosureProperty), iconSrc = data && data.hasOwnProperty('iconSrc'), disclosureEl, iconEl; innerItem.innerHTML = dataview.getItemTpl().apply(data); if (hasDisclosureProperty) { disclosureEl = extItem.down(me.disclosureClsCache); disclosureEl[data[disclosureProperty] === false ? 'addCls' : 'removeCls'](me.hiddenDisplayCache); } if (dataview.getIcon()) { iconEl = extItem.down(me.iconClsCache, true); iconEl.style.backgroundImage = iconSrc ? 'url("' + iconSrc + '")' : ''; } } }
Success! Looks like we've fixed this one. According to our records the fix was applied for
TOUCH-2894
in
Sprint 22 (2.0.2).


Reply With Quote