PDA

View Full Version : How to call a function with in Ext



rehanqu
6 Nov 2009, 11:51 PM
Hi guys..
I have quick question. I want to be able to access a funtion inside Ext from outside. Please see the example bleow:




//ext starts here
Ext.onReady(function(){
var spot = new Ext.ux.Spotlight({
easing: 'easeOut',
duration: .3
});

function display() {
spot.show("answerParticipant_faq10");
}
});
//ext ends here


function fnDisplayAnswer(ansId) {
var ObjContent11 = document.getElementById("answerParticipant_faq10");
ObjContent11.style.display = 'block';
display();
//Ext.show(ansId);
}




I want to be able to call display function from another function that is outside of ext (ex: fnDisplayAnswer)

Condor
7 Nov 2009, 12:07 AM
You'll have to create a global function. To keep things clean you should put these kinds of globals in your own namespace, e.g.


Ext.ns('mynamespace');
mynamespace.display = function(){
spot.show("answerParticipant_faq10");
}
...
mynamespace.display();

rehanqu
7 Nov 2009, 12:17 AM
thanks condor for your help...it works !!!