Injecting HTML from a file into an Ext.Panel


/ Published in: JavaScript
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.