You did not accept the answer, so I assume that you are still unclear. Here are some pointers ...
First, how your encoded panel will display as a simple square. If you expect it to look like a panel, you should give it a name (so that the title bar will be displayed).
Secondly, as already mentioned, click not a Panel event (this is an Element event). Thus, you have several ways to achieve your desired behavior. You can manually connect the listener to the basic DOM element after visualizing the panel:
Ext.get('txest123').on('click', function(){ alert('foo'); });
You can also do as I mentioned in the comments of another answer to generally handle any click of the body:
// .body is a Panel property for the body element content.body.on('click', function(){ alert('foo'); });
If you really want to limit the click to only a child of p , you can add a check:
// e is the event object, t is the target DOM node content.body.on('click', function(e,t){ if(t.id == 'txest123'){ alert('clicked the p'); } });
If I encoded this, I would probably do something similar:
var content = new Ext.Panel({ region:'center', renderTo: document.body, margins:'5 0 5 5', cls:'empty', title: 'My Panel', id: 'txest123', bodyStyle:'background:ivory; font-size: 13pt', html:'This is where the content goes for each selection.', listeners: { 'render': { fn: function() { this.body.on('click', this.handleClick, this); }, scope: content, single: true } }, handleClick: function(e, t){ alert(this.id);
Now the identifier is in the panel (where it should be), and you can use the Panel and / or Element methods to access the children as needed. It is best to maintain your identity at the highest level. You will also notice that the callback function is executed in the Panel area ( scope:this ), therefore inside handleClick you can consider this as the panel itself and refer to any of its properties or methods.
So, not knowing exactly what you are trying to achieve, I cannot provide you with the exact code that you need. However, this will hopefully give you some ideas.
EDIT . I wanted to say this initially ... in your code (as published) you are not actually showing Panel. As I mentioned in my answer to your related question, if you add Panel as an element to a container that is lazy, the DOM panel will not be selectable until the container provides it. In my code above, I added renderTo so that I don't have this problem, but if you don't, you will have to wait for the panel to be transferred after a while to access it.