![](/img/trans.png)
[英]Programmatically hide columns in GridComponent with Kendo UI for Angular
[英]How to active a tab in kendo ui angular 2 programmatically
Kendo UI angular 2 TabStripComponent 有一個方法 selectTab。 如何使用它來激活打字稿代碼中的選項卡?
您可以使用 tabstrip 組件中的 selectTab(index) 方法。
首先,在視圖組件中向選項卡添加一個選擇器:
<kendo-tabstrip #tabstrip>... </kendo-tabstrip>
現在,您可以通過以下方式訪問模塊中的標簽條
@ViewChild('tabstrip') public tabstrip: TabStripComponent;
最后,您可以使用其索引激活任何選項卡
tabstrip.selectTab(index);
如果你想看看,這里有一個Plunker 。
請注意,如果目標選項卡被禁用,它不會切換!
無法真正找到如何使用selectTab
方法,但您可以使用selected
屬性來決定哪個選項卡處於活動狀態。 如文檔所示
試試
[selected]="i == selected"
或
selected value = true from ts end
那么你想要的那個標簽就是actvie
ex:selected=0;
第一個選項卡將處於活動狀態
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.