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
| function boiteMultiAccordeon(titre,titreBoutonOk,contentHTML){
var sepVal = "¤¤";
var tabDeb = "<TABLE>";
var tabFin = "</TABLE>";
//Pas de fonction direct pour compter les occurences (ou alors utiliser regex)
var nbAccordeon = contentHTML.split(sepVal).length -1 ;
var tab = new Array();
var indTabDeb = 0;
var indTabFin = 0;
var indTitre = 0;
var tabTitre;
for (var i = 0; i<nbAccordeon; i++){
indTitre = contentHTML.indexOf(sepVal, indTabFin);
indTabDeb = contentHTML.indexOf(tabDeb, indTabFin);
indTabFin = contentHTML.indexOf(tabFin, indTabDeb);
tabTitre = contentHTML.substring(indTitre+sepVal.length,indTabDeb);
tabContent = contentHTML.substring(indTabDeb,indTabFin+tabFin.length);
tab[i] = new Ext.Panel({
title: tabTitre,
html: tabContent,
cls:'empty',
autoHeight: true
});
}
var accordion = new Ext.Panel({
split:true,
layout:'accordion',
items: tab,
autoHeight: true
});
//#### Fenetre d'affichage ####//
win_box_name = "win_NOSETTINGS_ACCORDEON_box"+cptWin;
function action1(evt){Ext.WindowMgr.get(win_box_name).close();}
var but_ok = new Ext.Button({text:titreBoutonOk,handler:action1,minWidth:100,region:'center'}); //centré que sous IE, pas sous Firefox...
var w = new Ext.Window({title:titre,id:win_box_name,layout:'fit',autoScroll:true,autoHeight:true/*parfois buggué sous IE...*/,width:800,resizable:true,items:[accordion,but_ok]}).show()
cptWin++;
} |
Partager