Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do :document.getElementById() in extjs syntax

Tags:

extjs

In jsp, if there is a hidden variable, we do this in js:

document.getElementById('hiddenVarId').setValue = 'xxx';

What is the extjs equivalent of document.getElementById().setValue = 'xxx';

like image 203
Victor Avatar asked Feb 28 '11 22:02

Victor


People also ask

What is the syntax of getElementById ()?

getElementById() is a quick way to access an element. Unlike the querySelector() method, the getElementById() is only available on the document object, not other elements. In this syntax, the id is a string that represents the id of the element to select. The id is case-sensitive.

What is document getElementById () value?

HTML DOM Document getElementById() The getElementById() method returns an element with a specified value. The getElementById() method returns null if the element does not exist. The getElementById() method is one of the most common methods in the HTML DOM.

What is Dom in Extjs?

Class. Description. Ext.dom.Element. Main class in Ext JS that wraps single HTML DOM element. It includes DOM manipulating methods with normalizing cross-browser issues so that programmers do not have to worry about cross-browser issues.


3 Answers

Ext.get('hiddenVarId').set({value: 'xxx'});

This another possibility that leverages the ExtJS method set(). This way you can set multiple attributes on an Ext.Element at once if that's something you also require now or later.

http://dev.sencha.com/deploy/dev/docs/?class=Ext.Element

like image 73
ChrisR Avatar answered Oct 20 '22 14:10

ChrisR


Ext.get('hiddenVarId').dom.value = 'xxx';

Ext.get returns an Ext.Element which has the actual DOM object in the dom property. You can then directly assign to the value property.

like image 40
wombleton Avatar answered Oct 20 '22 12:10

wombleton


Ext.getCmp('hiddenVarId').setValue('xxx');

Ext.get() vs Ext.getCmp()

like image 3
KBIIX Avatar answered Oct 20 '22 12:10

KBIIX