View Full Version : Help finding ID

27 Nov 2007, 9:48 AM
I'm trying to add cakePHP's SQL Log to a panel and put it in the southern region of my layout. Here's the problem: cake gives that div a different id every time. It does have a static class, though. I can do this:

var sql = Ext.select(".cake-sql-log");

Once I have that element, how do I find out what it's id is? I need the id for contentEl:

var sql = new Ext.Panel({
frame: true,
title: 'SQL Log',
collapsible: true,
contentEl: _____________, // I need the id of the div
region: 'south',
titleCollapse: true


27 Nov 2007, 10:13 AM
Pass true as the 2nd arg to select() - this will return CompositeElement instead of CompositeElementLite. The collection will then contain Elements, which will have IDs assigned.

27 Nov 2007, 11:24 AM
@hendricd - cakePHP appends a div at the bottom of each page with a random id that contains log and debugging information. That's what I'm trying to load into a panel. It's pre-existing markup, but I can't know the id ahead of time.

@tryanDLS - I tried this: var sql = Ext.select(".cake-sql-log", true); How do I find out what the id is? I tried assigning sql to contentEl, but that didn't work.

Any ideas?

27 Nov 2007, 11:31 AM
If you think there be only one:

var sqlDiv = Ext.select(".cake-sql-log", true).elements[0].id ;

27 Nov 2007, 11:33 AM
That's perfect! Thanks!