PDA

View Full Version : Ext.get on Ajax content



RazeWork
19 Jul 2010, 11:37 AM
Hi All,
Sorry if this is a really question, been googling it for a couple of hours and no joy.

What i've trying to do is attach a listener to some ajax content. But Ext can't find the object, i guess this is because its not being watched so to speak.



core_center.add({
id: 'sometab_1',
title: 'SomeTab',
autoLoad: 'some.html'
}).show();
var el = Ext.get('my_div');
el.on('click', function(){
alert('Hello World');
});


some.html basically consists of the followling.



<div id="my_div"></div>


How can i add the event to "my_div".

hendricd
19 Jul 2010, 11:51 AM
You'll want a mechanism that waits for the asynchronous arrival of the Element you seek:



Ext.lib.Event.onAvailable('my_div', function(obj){
this.on('click', ....... );
});