我正在使用 jquery ui 选项卡并尝试在初始化时将“选定”选项卡设置为 0,但它不会触发 tabselect 事件。如果我将“选定”选项卡设置为 1 或任何其他选项卡,则 tabselect 事件将触发。我的想法是,由于 0 索引选项卡是默认设置,因此将“选定”选项卡设置为默认值不会触发 tabselect 事件,因为它已经被选中。我这样想对吗?并且,有没有办法在 ui-tabs 实用程序的上下文中使其工作?
divRelationships.tabs({
select: function (e, ui) {
createRelationshipListBoxForWebObject(divRelationships, webObjectGuid, ui);
}
});
divRelationships.tabs("select", 0);
最佳答案
您可以根据您的需要使用 show
或 create
事件(show
似乎更接近您想要的)。每当显示“Tab 0”时(包括在选项卡小部件初始化时)都会调用 show
。
考虑到这一点,您就不必手动触发 select
事件。以下内容就足够了:
divRelationships.tabs({
show: function (e, ui) {
createRelationshipListBoxForWebObject(divRelationships, webObjectGuid, ui);
}
});
// Show will automatically be called when the tabs widget is created.
关于jquery - 如果在 init 中选择了默认选项卡,则不会触发 tabselect 事件处理程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8096868/