EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: rezzonico on February 18, 2021, 08:45:35 AM



Title: tab + refresh
Post by: rezzonico on February 18, 2021, 08:45:35 AM
I refresh the second tab (index = 1) with the following code:

$('#tt').tabs('getTab', 1).panel('refresh');

The problem is that I want to refresh the tab only if it has already been selected by the user.
How can I verify this ?
It may be that I need to verify the length of the tab content ...

<div id="tt" class="easyui-tabs" border="true">
    <div title="AAA" href="aaa.html"></div>
    <div title="BBB" href="bbb.html"></div>
</div>

Thanks for any help.
Miche


Title: Re: tab + refresh
Post by: jarry on February 18, 2021, 11:53:25 PM
Listen to the 'onSelect' event on the tabs component and you can decide whether to refresh the selected tab panel or not.
Code:
$('#tt').tabs({
onSelect: function(title,index){
$('#tt').tabs('getTab',index).panel('refresh');
}
})


Title: Re: tab + refresh
Post by: rezzonico on February 24, 2021, 01:40:20 AM
Thanks !

Regards
Miche