p:datagridのcelleditor内のp:commandLinkまたはp:commandButtonが機能していません。commandLinkをクリックすると、同じページにリダイレクトされます。 celleditorの中でcommandLinkはリスナーを見つけることはできませんが、celleditorの外に置くと完全に動作します。p:datagridのp:celleditor内のp:commandLinkは機能しません
<h:form id="form">
<p:growl id="msgs" showDetail="true"/>
<p:dataTable id="project" var="car" value="#{editdeleteview.proj_rec}" rowKey="#{car.id}" selection="#{editdeleteview.selected_rec}" selectionMode="single" editable="true" style="margin-bottom:20px">
<f:facet name="header">
All Projects
</f:facet>
<p:ajax event="rowEdit" listener="#{editdeleteview.onRowEdit}" update=":form:msgs"/>
<p:ajax event="rowEditCancel" listener="#{editdeleteview.onRowCancel}" update=":form:msgs"/>
<p:column headerText="ID">
<h:outputLabel value="#{car.id}" />
</p:column>
<p:column headerText="Title">
<p:commandLink ajax="false" action="#{editdeleteview.openObjects(car)}" ><h:outputText value="#{car.title}" /></p:commandLink>
<p:cellEditor>
<f:facet name="output"><p:commandLink ajax="false" action="#{editdeleteview.openObjects(car)}" ><h:outputText value="#{car.title}" /></p:commandLink></f:facet>
<f:facet name="input"><p:inputText value="#{car.title}" style="width:100%"/></f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Description">
<p:cellEditor>
<f:facet name="output"><h:outputText value="#{car.description}" /></f:facet>
<f:facet name="input"><p:inputText value="#{car.description}" style="width:100%"/></f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Insertion Time">
<p:cellEditor>
<f:facet name="output"><h:outputText value="#{car.insertionTimestamp}" /></f:facet>
<f:facet name="input"><p:inputText value="#{car.insertionTimestamp}" style="width:100%"/></f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Close Time">
<p:cellEditor>
<f:facet name="output"><h:outputText value="#{car.closeTimestamp}" /></f:facet>
<f:facet name="input"><p:inputText value="#{car.closeTimestamp}" style="width:100%"/></f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Edit" style="width:50px">
<p:rowEditor />
</p:column>
<p:column headerText="Delete">
<p:commandButton id="downloadLink1" value="Delete" ajax="false" class="btn btn-danger" icon="ui-icon-trash" action="#{editdeleteview.delete(car)}">
</p:commandButton>
</p:column>
</p:dataTable>
</h:form>
P:列のタイトルの下にcellEditorを外のcommandLinkが完璧に機能していますが、cellEditorを内のcommandLinkが動作していない、Bean内のリスナーは、私もこのcommandLink in cellEditor doesn't trigger action/actionListenerを試してみました
public String openObjects(Project p)
{
HttpSession session = SessionUtils.getSession();
session.setAttribute("project_id", p.getId());
session.setAttribute("project_title", p.getTitle());
//session.setAttribute("project_title", "Hamdan");
System.out.println("EditView: "+session.getAttribute("project_title").toString());
return "Objects.xhtml";
}
ですしかしそれは私のために働いていませんでした。どんな助力も高く評価されます。
'動作しない' 漠然とへの道である動作します。あなたの他の質問の1つは何かの重複としてマークされています。その複製には、さらにデバッグする方法に関する情報が含まれています。してください。 – Kukeltje
@Kukeltjeまた、私はそれらを試してみましたが、私は列 "title"の下のcellEditor内のコマンドリンクがリスナーを呼び出さず、エラーなしで同じページにリダイレクトするという問題を述べました。 –
@Kukeltje cellEditorタグ外のcommandLinkは完全に動作していますが、cellEditor内のcommandLinkを動作させたいと思います。 –