Der aktive Index wird nicht automatisch aktualisiert. ReaD in ein paar Posts, dass durch die tabView auf ein Formular funktioniert. Oder indem Sie <p:ajax event="tabChange"/>
in der Tabansicht einfügen, funktioniert es. Aber nichts scheintAktiver Index der tabview wird nicht automatisch aktualisiert
xhtml
Probe 1 zu arbeiten: automatische Updates
<p:tabView id="categoryTabView" var="promoArticle" value="#{promotionDetailBean.artDTOs}" activeIndex="#{promotionDetailBean.activeTabIndex}">
<p:tab id="categoriesTab" title="#{promoArticle.categoryName}">
<p:dataTable id="promotionDetail_dataTable" var="articlePromo" value="#{promoArticle.artVO}" selection="#{promotionDetailBean.selectedArt}" rowIndexVar="rowIndex">
<p:column id="select" selectionMode="multiple" />
<p:column id="barCode">
<h:inputText id="barCodeInputTxt" value="#{articlePromo.barCode}"
styleClass="inputTextStyle" onchange="onSuggestedValueChange('categoryTabView',#{promotionDetailBean.activeTabIndex}, 'promotionDetail_dataTable',#{rowIndex},'originalCostInputTxt')" />
</p:column>
</p:dataTable>
</p:tab>
</p:tabView>
Probe 2: Aktualisierung auf tabChange Ereignis
<h:form id="form">
<p:growl id="growlm" showDetail="true" />
<p:tabView id="categoryTabView" var="promoArticle" value="#{promotionDetailBean.artDTOs}" >
<p:ajax event="tabChange" listener="#{promotionDetailBean.tabChanged}" update=":growlm" />
<p:tab id="categoriesTab" title="#{promoArticle.categoryName}">
<p:dataTable id="promotionDetail_dataTable" var="articlePromo" value="#{promoArticle.artVO}" selection="#{promotionDetailBean.selectedArt}" rowIndexVar="rowIndex">
<p:column id="select" selectionMode="multiple" />
<p:column id="barCode">
<h:inputText id="barCodeInputTxt" value="#{articlePromo.barCode}"
styleClass="inputTextStyle" onchange="onSuggestedValueChange('categoryTabView',#{promotionDetailBean.activeTabIndex}, 'promotionDetail_dataTable',#{rowIndex},'originalCostInputTxt')" />
</p:column>
</p:dataTable>
</p:tab>
</p:tabView>
Ich muss die Zelle auf "OnChange" -Ereignis identifizieren. Aber der activeIndex ist immer 0, der initialisierte Wert. Das Ereignis wird nicht angerufen.
bean
private Integer activeTabIndex = 0;
public Integer getActiveTabIndex() {
return activeTabIndex;
}
public void setActiveTabIndex(Integer activeTabIndex) {
this.activeTabIndex = activeTabIndex;
}
bean
public void tabChanged(TabChangeEvent event){
TabView tv = (TabView) event.getComponent();
this.activeTabIndex = tv.getActiveIndex();
}
Aber das Ereignis trigerred immer nicht. Wird auch nicht automatisch aktualisiert.
Was könnten die wahrscheinlichen Probleme sein?
Danke, Shikha
Das scheint nur zu funktionieren, wenn [aktiver Index nicht an die verwaltete Bean gebunden ist] (http://code.google.com/p/primefaces/issues/detail? id = 1640 & q = activeIndex & colspec = ID% 20Stars% 20Modul% 20Typ% 20Status% 20Priorität% 20TargetVersion% 20Reporter% 20Owner% 20Zusammenfassung). Ich bin erstaunt, dass das Team von Primefaces es noch nicht gelöst hat (ich arbeite mit Version 3.5). Es funktioniert jedoch, wenn das 'tabView' selbst in ein Formular eingewickelt wird, anstatt für jede Registerkarte ein Formular zu haben. –
this.activeTabIndex = tv.getActiveIndex(); funktioniert nicht. Stattdessen können Sie this.activeTabIndex = tv.getChildren() verwenden. IndexOf (event.getTab()); – ahmet
Index beginnt mit 0 oder 1? – xav56883728