PDA

View Full Version : tpl and id not working with ext.container after 0.94



ueilat
24 Sep 2010, 1:05 PM
this post was patially posted before. unfortunately I couldn't post the code not working due to moderated posts-

my code is




<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Fiorentina.it</title>

<!-- Ext Touch CSS -->
<script>
function loggo(cosa) {
console.log(cosa);
};


</script>

<link rel="stylesheet" href="sencha-touch-beta-0.95/resources/css/ext-touch.css" type="text/css">





<!-- Ext Touch JS -->



<script type="text/javascript" src="sencha-touch-beta-0.95/ext-touch-debug.js"> </script>



<!-- Application JS -->
<script>
var blocchi=new Array();
var blocchimax=10;
for (var i=0;i<=blocchimax;i++) {
blocchi[i]=null;
};
var barrasencha=42;


Ext.setup({
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
icon: 'icon.png',
glossOnIcon: false,
onReady: function() {



var modale=function(testo) {
if (testo!="") {
Ext.getBody().mask(false, '<div class="modale">'+ testo +'&hellip;</div>');
} else {
Ext.getBody().unmask();
}
};


var chiama=function(tipopaginax,parametrix) {
//loggo('chiamando');
modale('carico');
generapagina(tipopaginax,1,parametrix)
};


var generapagina=function(tipopagina,tiporigen,parametri){





blocchi[1]=new Ext.Container({
cls: 'titolihome',
html: 'News',
height: 20,
monitorOrientation : false
});
ct.add(blocchi[1]);
blocchi[2]=new Ext.Container({
cls: 'listahome',
id: 'listahome1',
tpl: '<tpl for="."><div class="lista" onclick="javascript:lancialista({idnotizia},2,this)"><div class=testo1><b>{datanotizia}</b> {titolo}</div></div></tpl>',
monitorOrientation : false
});
blocchi[6]=new Ext.Container({
height: (480-barrasencha-20-20)/2,
items: blocchi[2],
monitorOrientation : false
});
ct.add(blocchi[6]);
blocchi[3]=new Ext.Container({
cls: 'titolihome',
html: 'In primo piano',
height: 20,
monitorOrientation : false,
});
ct.add(blocchi[3]);
blocchi[4]=new Ext.Container({
cls: 'listahome',
id: 'listahome2',
tpl: '<tpl for="."><div class="lista" onclick="javascript:lancialista({idnotizia},2,this)"><div class=testo1><tpl if="foto"><img align=right src="{foto}"></tpl><b class=titoletti>{titolo}</b><br/>{descrizione}</div></div></tpl>',
monitorOrientation : false
});
blocchi[5]=new Ext.Container({
height: (480-barrasencha-20-20)/2,
items: blocchi[4],
monitorOrientation : false
});
ct.add(blocchi[5]);
barratop.insert(0,{ xtype: 'button', text: '?', ui: 'normal', handler: alert});
// barratop.insert(0,{ iconCls: 'info', ui: 'mask'});
barratop.insert(1, {xtype: 'spacer'});

barratop.insert(3, {xtype: 'spacer'});
barratop.insert(4,{ui: 'mask', iconCls: 'credit', handler: alert});
barratop.doLayout();
ct.doLayout();
//document.getElementById('selettore').setActive(0);
// scrollaPrivato(document.getElementById('listahome1'),document.getElementById('listahome1').parentNode,false,true,1);
// scrollaPrivato(document.getElementById('listahome2'),document.getElementById('listahome2').parentNode,false,true,1);
//alert(document.getElementById(blocchi[4].getEl().id).style.top);


blocchi[2].update([{
datanotizia: 'Item 1',
titolo: '1'
}, {
datanotizia: 'Item 2',
titolo: '2'
}, {
datanotizia: 'Item 2',
titolo: '3'
}]);
blocchi[2].doLayout();
// blocchi[3].add(memoria[genpaginap1].dati["altrenews"]);
// blocchi[3].doLayout();
blocchi[4].update([{
datanotizia: 'Item 1',
titolo: '1'
}, {
datanotizia: 'Item 2',
titolo: '2'
}, {
datanotizia: 'Item 2',
titolo: '3'
}]);
blocchi[4].doLayout();


modale('');

}
//**********************************+'





modale('carico');
//GESTISCO VARIABILI PERMANENTI
//localStorage.setItem("fontsize", 1);
//localStorage.clear();

document.body.innerHTML='';


//loggo('configurato');


barratop = new Ext.Toolbar({
// dock this toolbar at the top
ui: 'dark',
dock: 'bottom',
cls: 'barratop',
monitorOrientation: false /*,
items: [ {xtype: 'spacer',
id:'fisso1'} ,
{ html: '<img src="images/logo.png">',
xtype:'container',
centered:true,
id: 'fisso2'
},
{xtype: 'spacer',
id:'fisso3'}
] */
});


//QUESTO E' IL CONTENITORE PRINCIPALE
ct = new Ext.Panel({
fullscreen: true,
cls: 'sfondo',
dockedItems: barratop,
monitorOrientation: false

// onOrientationChange : function(orientation, w, h) {
// //loggo('ruoto ' + this.id+ ' - ' + orientation + ' ' + w + 'x' + h);
// }


});


//loggo('chiamo');

lanciatoInizio=true;
chiama(1,'');



//NKAlert(NKGetLibraryVersion());


}
});
</script>

</head>
<body> <h1>Application starting....</h1></body>
</html>


if you try in 0.93 is ok
in 0.94 and 0.95 doesn't work update on tpl and the id is not assigned to the elements blocchi[2] and blocchi[4]

ueilat
27 Sep 2010, 1:05 AM
no one can help in understanding the issue?

ueilat
1 Oct 2010, 5:05 AM
even with 0.96 same issue
you can test at http://www.fiorentina.it/iphone/me2/test.html
Can you help?
If I make a mistake I can correct it. Otherwise I must change completely my approach to the app if this behaviour is standard