开发者

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

In jsp, if there is a hidden v开发者_如何学Goariable, we do this in js:

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

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


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


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.


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

Ext.get() vs Ext.getCmp()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜