Posted By

LeeProbert on 03/31/11


Tagged

ajax javascript Ext ExtPanel


Versions (?)

Injecting HTML from a file into an Ext.Panel


 / Published in: JavaScript
 

Sometimes you have a load of HTML that is difficult to write up as a String from within a javascript function so this is an example of a simple Panel with an event for after rendering that injects it with content from a file.

  1. whereMainPanel = new Ext.Panel({
  2.  
  3. layout:{align:'stretch'},
  4. cls:'whereMainPanel'
  5. });
  6.  
  7.  
  8. whereMainPanel.on('afterrender',function()
  9. {
  10. Ext.Ajax.request({
  11. url: 'assets/animation/WhereAnimProj/WhereAnimProj_export/index.html',
  12. success: function(response, opts) {
  13. whereMainPanel.update(response.responseText);
  14. }
  15. })
  16.  
  17. this.body.on('click',function(){ menuPanel.setActiveItem(1); backBtn.setVisible(true); })
  18. })

Report this snippet  

You need to login to post a comment.