PDA

View Full Version : [FIXED] styleHtmlContent is not really a boolean



cyberwombat
14 Nov 2011, 5:17 PM
styleHtmlContent is the same regardless of the value being true, 'true', false, 'false', 1, 0, '1', '0'. These all equal true. Only null makes it false. The docs says the default is null but it also claims it's a boolean which I don't think it is -it's a little confusing.

I am looking at this page: http://docs.sencha.com/touch/2-0/#!/api/Ext.Component-cfg-styleHtmlContent

Jamie Avins
15 Nov 2011, 8:22 AM
Thank you for the report.

Jamie Avins
15 Nov 2011, 4:01 PM
Do you have an example of where you are seeing this? There is a falsey check on this and we will for a forced Boolean on apply. As far as the documentation goes, I'll check if the parser can be changed to properly handle that as null has a special meaning within the library and is used to improve instantiation performance.

cyberwombat
15 Nov 2011, 4:04 PM
I tested this on a list view.


Ext.define("MyApp.view.FriendsList", {
extend: "Ext.List",
xtype: "friendslist",
config: {
indexBar: true,
styleHtmlContent: null, //<--- here - only null or commented worked for me
grouped: false,
locked: true,
itemTpl: '<div <tpl if="avatar">style="background: url(http://src.sencha.io/jpg100/72/{avatar});"</tpl> class="avatar"></div><div class="name">{name}</div>'
}
});

Jamie Avins
15 Nov 2011, 4:16 PM
Both issues should now be resolved for the next release.

fhellwig
8 Apr 2012, 2:04 PM
The applyStyleHtmlContent method still wraps the argument in a Boolean object.

Therefore, the updateStyleHtmlContent method sees a false as true since the

if (styleHtmlContent) {
...
}
statement evaluates as true since any object (except for null) is considered true.

Please fix soon. Thanks.

Jamie Avins
9 Apr 2012, 8:43 AM
Fair enough.

Jamie Avins
9 Apr 2012, 1:15 PM
Actually, since it's a forced boolean, how can it ever be an Object unless it's being called directly.

IntegrifyDev
17 May 2013, 5:07 AM
Still appears to not work in 2.2.0 (Build date: 2013-04-11 12:51:10)



Ext.define('IntegrifyM.view.instance.Detail',
{
extend:'Ext.Panel',
alias:'widget.instance_detail',
config: {
styleHtmlContent:false //setting to null does work
},
initialize : function() {
this.callParent(arguments);
}
});