gpt4 book ai didi

javascript - 在 ExtJs 中模拟点击 tabpanel

转载 作者:行者123 更新时间:2023-11-28 21:34:37 31 4
gpt4 key购买 nike

首先让我说这个问题是 ExtJS 库中的 TabPanel 特有的。我可以使用 jQuery("#id").click() 函数成功地模拟对其他 ExtJS 组件的点击。

但我无法使用 jQuery 在 ExtJS 中模拟用户点击 TabPanel 的给定选项卡。我看到选项卡后面的 dom 结构如下所示:

<ul class="x-tab-strip x-tab-strip-top" id="ext-gen15">
<li id="ext-comp-1009__ext-comp-1001" class="x-tab-strip-active">
<a class="x-tab-strip-close" id="ext-gen18"></a>
<a href="#" class="x-tab-right" id="ext-gen19">
<em class="x-tab-left">
<span class="x-tab-strip-inner">
<span class="x-tab-strip-text">Submarine</span>
</span>
</em>
</a>
</li>
<li id="ext-comp-1009__ext-comp-1003" class="">
<a class="x-tab-strip-close" id="ext-gen20"></a>
<a href="#" class="x-tab-right" id="ext-gen21">
<em class="x-tab-left">
<span class="x-tab-strip-inner">
<span class="x-tab-strip-text">SpaceShuttle</span>
</span>
</em>
</a>
</li>
<li class="x-tab-edge" id="ext-gen16">
<span class="x-tab-strip-text">&#160;</span>
</li>
<div class="x-clear" id="ext-gen17"></div>
</ul>

我尝试了多种使用 jQuery 选择第一个选项卡的方法:

jQuery("#ext-comp-1009__ext-comp-1001").click();
jQuery("#ext-gen18").click();
jQuery("#ext-gen19").click();

但似乎都不起作用。

最佳答案

如果你take a look at the source (特别是搜索 onStripMouseDown)您会看到它需要一个 Ext.EventObject。它会立即失败,因为 e.button 不是 0。

大概你可以用你自己的 onStripMouseDown 来修补它。

关于javascript - 在 ExtJs 中模拟点击 tabpanel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4518215/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com