PDA

View Full Version : What is the Ext.get('id') equivalent in extjs4.1?



darkhorni
20 Jun 2012, 1:19 AM
What is the Ext.get('id') equivalent in extjs4.1?

evant
20 Jun 2012, 1:25 AM
It hasn't changed. You'll need to post more info. Being cryptic makes it difficult to answer your questions.

darkhorni
20 Jun 2012, 1:33 AM
I have an menu item in grid column header menu

menu: {
items: [{
xtype: 'numberfield',
name: 'satirSayisi',
id: 'numberOfRows',
value: pageSize,
allowBlank: false,
allowDecimals: false,
minValue: 1,
maxValue: 10000
}]
}
And I want to get its value from some different location with

Ext.get('numberOfRows').getrawValue()
But
console.log(Ext.get('numberOfRows')); returns null

First I thought that the numberfield is being destroyed but then I've saw that after I open the menu the value that I have edited is still there. So, I don't think that it is being destroyed.

36364

sasklacz
20 Jun 2012, 1:57 AM
and does document.getElementById(yourid) return you anything ?

packagedeliverer
20 Jun 2012, 1:59 AM
Perhaps you could try:

Ext.getCmp('numberOfRows')

darkhorni
20 Jun 2012, 1:59 AM
and does document.getElementById(yourid) return you anything ?

console.log(document.getElementById('numberOfRows')); says null

evant
20 Jun 2012, 2:54 AM
Then it means your element doesn't exist in the DOM yet.

packagedeliverer
20 Jun 2012, 3:17 AM
Or maybe the element with that id is declared twice?

Did you try getCmp?

sasklacz
20 Jun 2012, 2:15 PM
console.log(document.getElementById('numberOfRows')); says null

I'd say that you want to get this element before your menu was displayed or after it was destroyed. That's why this element doesn't exist in the dom. Try opening your menu, and then running this command in the console. What is the result ?