PDA

View Full Version : How to Ext.DomHelper.append ?



kimu
25 Mar 2007, 5:46 AM
I want to use Ext.DomHelper.append, but I'm not able to use it. This is my code:


rules = Ext.util.JSON.decode(o.responseText);
var ruleSelect = document.getElementById('validation-rule')
for(var i = 0, limit = rules.length; i < limit; i++){
opt = document.createElement('option');
opt.value = rules[i];
opt.innerHTML = rules[i];
ruleSelect.appendChild(opt);
}


Everything goes well with this code. If I try to do the same with Ext.DomHelper.append I obtain nothing. This is my code, what is wrong with this?:


rules = Ext.util.JSON.decode(o.responseText);
for(var i = 0, limit = rules.length; i < limit; i++){
Ext.DomHelper.append('validation-rule',{
tag:'option', value:rules[i], html:rules[i]
});
}


Thanks for your help

Animal
25 Mar 2007, 6:59 AM
On IE? IE's addition of options elements is flaky. McSoft eh? Who'd a thunk it?

Try adding

Ext.DomHelper.useDom = true;

before your call to append the option.

kimu
25 Mar 2007, 8:22 AM
Thanks Animal,
with

Ext.DomHelper.useDom = true

works perfectly also on IE

Bye