1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
| Ext.app.OwnerLoader = Ext.extend(Ext.ux.XmlTreeLoader, {
processAttributes : function(attr){
if(attr.nom){ // is it an owner node?
// Set the node text that will show in the tree since our raw data does not include a text attribute:
attr.text = attr.nom + ' ' + attr.prenom + ' (' + attr.pol + ') - ' + attr.cp + ' ' + attr.ville;
// Author icon, using the gender flag to choose a specific icon:
attr.iconCls = 'author-m';
// Override these values for our folder nodes because we are loading all data at once. If we were
// loading each node asynchronously (the default) we would not want to do this:
attr.loaded = true;
attr.expanded = false;
}
else if(attr.numdgd){ // is it a dgd node?
// Set the node text that will show in the tree since our raw data does not include a text attribute:
attr.text = attr.numdgd + ' (G�n ' + attr.gendgd + ') - ' + attr.surfdgd + ' ha - ' + attr.etatdgd;
// Book icon:
attr.iconCls = 'book';
// Tell the tree this is a leaf node. This could also be passed as an attribute in the original XML,
// but this example demonstrates that you can control this even when you cannot dictate the format of
// the incoming source XML:
attr.leaf = true;
}
}
});
function initFormSearchmerlTreeContent(){
var detailsText= '<i>Sélectionnez un Document de Gestion Durable pour obtenir plus d\'informations</i>';
/* vartpl=newExt.XTemplate(
'<h2class="dgd">{dgd}</h2>',
'<p><b>Digitalisation</b></p>',
'<p>Digitalisation:',
'<tplfor="node.gendgd">',
'<tplif="node.gendgd==2">',//<--Notethatthe>isencoded
'<p>{gendgd}</p>',
'</tpl>',
'</tpl></p>',
'<p>Datededigitilisation:{gendgd}</p>',
'<p><b>Cartedespeuplements</b></p>',
'<p><b>Synopsis</b>:{innerText}</p>',
'<p><ahref="{url}"target="_blank">PurchasefromAmazon</a></p>'
);
tpl.compile();
*/
var pan_SearchmerlTree = new Ext.Panel ({
renderTo: 'tree',
border: false,
items:[{
layout: 'column',
items: [{
columnWidth:0.40 ,
border: false,
items:[{
xtype: 'treepanel',
id: 'tree-panel',
autoScroll: true,
rootVisible: false,
root: new Ext.tree.AsyncTreeNode(),
loader:new Ext.app.OwnerLoader({
dataUrl:'searchmerl-xml-tree-data.xml'
}),
listeners:{
'render':function(tp){
tp.getSelectionModel().on('selectionchange',function(tree,node){
var el= Ext.getCmp('details-panel').body;
if(node.leaf){
tpl.overwrite(el,node.attributes);}
else{
el.update(detailsText);}
})
}
}
}]
},{
columnWidth:0.60,
border: false,
items:[{
title: 'Détails',
id: 'details-panel',
autoScroll: true,
html: detailsText
}]
}]
}]
});
return pan_SearchmerlTree;
}; |
Partager