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()
精彩评论