title: ExtJS: dynamically changing element styles
body: <p>I'm trying to dynamically assign styles to my elements (in this case, a ExtJS <code>displayfield</code>).</p>
  
  <p>I can't use CSS classes since I don't know what the colors will be until runtime.</p>
  
  <p>I'm trying:</p>
  
  <pre><code>myDisplayField.getEl().applyStyles({ color: '#ff0000' });  //fail
  myDisplayField.getEl().setStyle('color', '#ff0000');       //fail
  </code></pre>
  
  <p>Just to get the mechanism right, but neither seem to work.</p>
  
  <p>It works using <code>Ext.get(&lt;div id&gt;).setStyle(...)</code>, but that doesn't seem as clean to me. Is there a reason the former attempts don't work?</p>
  
  <p>What am I missing? 
  Thanks.</p>