EasyUI Forum
May 06, 2024, 09:55:48 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Tab not unload its content on close  (Read 7541 times)
arma
Full Member
***
Posts: 110


View Profile
« on: October 13, 2013, 10:50:10 PM »

I have a closable tab which contains grid and grid toolbar. One of toolbar item will show a dialog (#mydialog) on click which contains form.
In console log $('#mydialog form') will show only 1 form. I then close the tab, and reopen tab. Console log again $('#mydialog form') there would be 2 forms. The form number would be incremented everytime i close and reopen tabs.

What's the proper way to unload tab content? Do i have to remove the content in tab onClose event manually?

Edit: It seems closing tabs does not destroy the dialog, so it keeps in memory. When the tab loaded again, a new dialog will be recreated by jeasyui which will make the form become duplicated. When i submit the form the fields would be messy Sad
« Last Edit: October 14, 2013, 01:26:15 AM by arma » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: October 14, 2013, 07:02:30 PM »

When a dialog(inline=false) is created, it will be moved to <body>. If this dialog is created from a markup that hosted in a tab panel, it will not be destroyed automatically after the tab panel is closed. Please try the code below to solve this issue.
Code:
$('#tt').tabs({
  onBeforeClose:function(){
    $('#mydialog').dialog('destroy');
  }
});
Logged
arma
Full Member
***
Posts: 110


View Profile
« Reply #2 on: October 15, 2013, 08:33:39 AM »

It seems .dialog('destroy') is not in the jeasyui doc?

If i have dynamic tabs, how could i detect if some tab has dialog, so i could specify its dialog id and closed it onBeforeClose.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!