PDA

View Full Version : Use of Ext.get on dynamic DOM created through Direct



Pachat
11 Jul 2011, 9:30 AM
Hi,

I use Direct. On response, I want to change the innerText of div, like

<div id="value_name">Super User</div>from Super User, to the value I get in response, let say John

<div id="value_name">John</div>I tried this in my .js code

new Ext.grid.RowSelectionModel({
singleSelect: true
,listeners: {
rowselect: function(sm,index,record){

controller.joins(record.data.id,uid,function(provider,reponse){
recuser=record;
recuser.data=reponse.result.users.records[0];
Ext.get('value_username').innerText =
recuser.data.username;
});
}
}an alert shows me that recuser.data.username holds the correct value.
But it does not to change the innerText of the div.

Is Ext.get('value_username').innerText the correct function/property to access the DOM within a response?

Pachat
11 Jul 2011, 10:48 AM
The correct code is

Ext.getDom('value_username').innerHTML = recuser.data.username;Has any one an explaination? Why getDom instead of get? Why innerHTML and not innerText?

skirtle
14 Jul 2011, 1:59 AM
Ext.get() returns an Ext.Element for the node, whereas Ext.getDom() returns the raw browser DOM node: equivalent to Ext.get(...).dom.

You should be able to change things via innerText but it doesn't work in all browsers.

Pachat
15 Jul 2011, 9:38 AM
Thank you for your explanation