0
讓我開始說這個問題是特定於ExtJS庫中的TabPanel。 我可以使用jQuery(「#id」)。click()函數成功模擬對其他ExtJS組件的點擊。模擬ExtJs中的tabpanel點擊
但我不能模擬用戶點擊使用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"> </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();
但沒有它似乎工作。
您可以使用Ext.getCmp,然後在組件上爲click事件調用fireEvent()。 – Lloyd 2010-12-23 11:33:18