View Full Version : Ext.ComponentQuery.query

13 Nov 2012, 11:38 AM
I'm trying to use Ext.ComponentQuery.query to query for a window title, apparently it does not like the comma in the title.

Ext.ComponentQuery.query('window[title="Google, Inc"]');


Ext.Error: Invalid ComponentQuery selector: "[title="Google"

Does anyone know a solution around that?

Thank You,

Tim Toady
13 Nov 2012, 11:42 AM
Comma is used a delimeter between different selectors. Use a selector that doesn't use a comma. itemId perhaps?

IMO, it is an Ext bug in this instance.

13 Nov 2012, 11:47 AM
I'm using a grid that lists companies and when you click on a company's name is Ext.create a window for it. The reason I'm using Ext.Com.Query and look for the title is because if it exists then I don't have to load it but instead bring it to the front of other windows. Windows do not open in modal true. You can open 4 different windows at the same time.

13 Nov 2012, 1:08 PM
You could strip the special characters from the title and store it in a different property (itemId?) of your Window instance and use this property for ComponentQuery.

Since you are only interested in Windows, why bother ComponentQuery with filtering by xtype. I would rather use this code:
var window=Ext.WindowManager.getBy(function(win){return win.title==='My, Title, containing, Comma';})[0]