EXTJS - Create new tab only if it does not exist


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



Copy this code and paste it in your HTML
  1. /**
  2. * Create new tab only if it does not exist before
  3. */
  4.  
  5. // Show tab way
  6. HO.Class.CRUD.prototype.showTab = function (id,name) {
  7.  
  8. HO.log("HO.Class.CRUD.showTab " + id + " " + name);
  9.  
  10. var tabID = this.ComponentName + id;
  11. var tab = this.TabPanel.items.find(function(i){
  12. return i.id === tabID;
  13. })
  14. if (!tab) {
  15. showObject = this.getShowObject(id,tabID, name);
  16.  
  17. this.TabPanel.add( showObject ).show();
  18. // x = {title: "dupa", layout: 'fit', items: [showObject]
  19. // ,autoScroll : true
  20. // ,bodyStyle : 'position:relative'
  21. //
  22. // }
  23. //
  24. // this.TabPanel.add( x ).show();
  25.  
  26.  
  27. } else {
  28. HO.log('tab exists');
  29. this.TabPanel.setActiveTab(tabID);
  30. }
  31. }
  32. // eo function showTab
  33.  

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.