easyui选项卡tab使用技巧

easyui选项卡上面的刷新按钮实现刷新操作
面板上的选项卡是动态生成的,带有刷新小按钮和关闭小按钮,点击刷新小按钮的时候刷新当前tab面板内容。实现代码:
[code lang=”js”]
$(‘#main’).tabs(‘add’,{
title:title,
content:content,
closable:true,
tools:[{
iconCls:’icon-mini-refresh’,
handler:function(){
var pp = $(‘#main’).tabs(‘getSelected’);//选中的选项卡对象
var content = pp.panel(‘options’).content;//获取面板内容
//console.log(tab);
$("#main").tabs(‘update’,{//更新
tab:pp,
options:content
})
}
}]
});
[/code]

————————————
关闭所有选项卡tab的方法
[code lang=”js”]
function removePanel(){
$(‘#main ul li’).each(function(index){
var tab = $(".tabs-closable", this).text();
if(tab!="首页") $("#main").tabs(‘close’, tab);//除了标签为首页的其他全部关闭
});
[/code]