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
| refreshBiblioSheet: function(aRecord) {
...
...
var el = Ext.get("mybibliosheet");
myAPP.util.Templates.TplBiblioSmooth.overwrite(el, aRecord.data);
...
...
// CODE CPC
var parent = Ext.get("idcpc");
if (parent) {
var elems = parent.select("span.helponline_cpc").elements;
Ext.each(elems, function(elem) {
var myCode = elem.id.substr(4, elem.id.length);
Ext.create('Ext.tip.ToolTip', {
// The overall target element.
target : elem,
// Delay in milliseconds before the tooltip automatically hides. To disable automatic hiding, set dismissDelay = 0.
dismissDelay : 0,
// Render immediately so that tip.body can be referenced prior to the first show.
renderTo : Ext.getBody(),
title : 'CPC Definition: ' + myCode,
listeners : {
// Change content dynamically depending on which element triggered the show.
beforeshow: function updateTipBody(tip) {
tip.update('Please wait, Loading...');
var task = new Ext.util.DelayedTask(function() {
// Make you ajax call here and update the tooltip in its callback method
Ext.Ajax.request({
url : 'xxxxx.php',
method : 'post',
params : {
code : myCode
},
success: function (data) {
if (!Ext.isEmpty(data.responseText)) {
var res = Ext.JSON.decode(data.responseText);
tip.update(res.data);
} else {
tip.update('Definition not available for this CPC code');
}
},
failure: function (data) {
// Opérations en cas d'échec de la requête
tip.update('Error: Definition not available for this CPC code');
}
});
});
task.delay(2000);
}
}
});
});
}
/* FIN DES DECLARATION HELP ONLINE HINT */
...
...
} |
Partager