PDA

View Full Version : Use of a function in XTemplate make app NOT work on iOS and some Android. Why?



slmd
12 Oct 2011, 6:38 AM
Hi,

I am having a hard time understanding why is this code working on SOME Android devices BUT no iOS except iPad. Enought talk, some code


var homelisting = new Ext.XTemplate(
'<tpl for".">',
'<div class="{class}">',
'<img class="gameIcon" src="{thumbnail}" alt="{title}" />',

'<div class="short_desc">{[Ext.util.Format.ellipsis(values.description, this.descriptionLength(values.class))]}</div>',

/*The descriptionLength function above is declared below but when i hide this line (above) my application works on all devices otherwise it's not the case as stated before. */

'</div>',
'</tpl>',
{
descriptionLength: function(myClass) {
if (myClass == "gold") {
return 110;
} else {
return 87;
}
}
}
);


Thank you!

slmd
13 Oct 2011, 6:35 AM
Can someone tell me another way to rewrite this code mentionned abode please?
Thank you!

slmd
14 Oct 2011, 5:52 AM
I found out it was due to the fact i was using the reserved javascript word "{class}" in order to call the classname i set from the JSON. I renamed it and it's now working perfect on every device.