SoFunction
Updated on 2025-03-06

jQuery Easyui Tabs extension opens tabs based on custom properties

easyi is a lightweight backend management system framework with various components, which are simple and convenient to use. Now there is a free version of License.

1. Add expansion

<script type="text/javascript" >
/**
 * @author {kexb} easyi-tab extension to switch page according to id
 */
$.extend($., {
getTabById: function (jq, id) {
var tabs = $.data(jq[0], 'tabs').tabs;
for (var i = 0; i < ; i++) {
var tab = tabs[i];
if (('options').id == id) {
return tab;
}
}
return null;
},
selectById: function (jq, id) {
var tab;
var tabs = $.data(jq[0], 'tabs').tabs;
for (var i = 0; i < ; i++) {
tab = tabs[i];
if (('options').id == id) {
break;
}
}
if (tab != undefined) {
var curTabIndex = $("#tabs").tabs("getTabIndex", tab);
$('#tabs').tabs('select', curTabIndex);
}
},
existsById: function (jq, id) {
return ('getTabById', id) != null;
}
});
</script>

2. Click event open method

function Open(text, url, id) {
var tabId = ReplaceAll(url, '/','');
var h = ComputGridHeight();
if (url == "null" || url == "" || url == "") {
return;
}
if ($("#tabs").tabs("existsById", tabId)) {
$("#tabs").tabs("selectById", tabId);
}
else
{
if (("?") < 0) {
url += "?_menuId=" + id;
}
else {
url += "&_menuId=" + id;
}
$('#tabs').tabs('add', {
id:tabId,
title: text,
closable: true,
content: createTabContent(url, h),
url: url
});
}
}

The above is the jQuery Easyui Tabs extension introduced to you. Open the tab according to custom properties. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to everyone in time. Thank you very much for your support for my website!