Primefaces Löschen & Bestätigen Dialogfeld innen-Tabelle-Spalte - Update oder Freeze-Problem

Habe ich ein smiliar problem wie hier: Primefaces: commandButton in confirmDialog nicht aktualisieren datatable in der gleichen form

Ich habe eine Tabelle mit spielen. In der letzten Spalte gibt es 2 buttons: löschen und details.

Den löschen-button löschen das Spiel

Wird der button löschen Sie das Spiel, aber das update funktioniert nicht.

  • update=":form1:overviewTableGame" --> keine Reaktion (kein refresh)

  • update="@form" --> update führt ' (Tabelle aktualisiert), aber der gesamte scren gesperrt ist. ich denke, aufgrund der Tatsache, dass die form, die enthält das Dialogfeld wird aktualisiert...

Den Tisch-code:

<h:form id="form1">
        <p:messages id="messages" showDetail="true" autoUpdate="true"
            closable="true" />

        <p:dataTable id="overviewTableGame" var="game" value="#{gameMB.list}">
            <p:column headerText="#{msg.ID}" sortBy="#{game.id}">
                <h:outputText value="#{game.id}" />
            </p:column>

            <p:column headerText="#{msg.NAME}" sortBy="#{game.name}">
                <h:outputText value="#{game.name}" />
            </p:column>

            <p:column headerText="#{msg.DESCRIPTION}"
                sortBy="#{game.description}">
                <h:outputText value="#{game.description}" />
            </p:column>

            <p:column headerText="#{msg.ADMIN}" sortBy="#{game.admin.firstname}">
                <h:outputText value="#{game.admin.firstname}" />
            </p:column>

            <p:column headerText="#{msg.ACTION}">
                <p:commandButton id="commandButtonDELETE" value="löschen"
                    onclick="confirmation.show()" type="button"
                    update=":form1:display">
                    <f:setPropertyActionListener value="#{game}"
                        target="#{gameMB.selectedGame}" />
                </p:commandButton>

                <p:commandButton id="commandButtonDETAIL" value="detail"
                    action="#{gameMB.details()}">
                    <f:param name="id" value="#{game.id}" />
                </p:commandButton>
            </p:column>
        </p:dataTable>

        <p:confirmDialog id="confirmDialog"
            message="Are you sure about destroying the world?"
            header="Initiating destroy process" severity="alert"
            widgetVar="confirmation">


            <h:panelGrid id="display" columns="2" cellpadding="4"
                style="margin:0 auto;">

                <h:outputText value="Name:" />
                <h:outputText value="#{gameMB.selectedGame.name}"
                    style="font-weight:bold" />

                <p:commandButton id="confirm" value="Yes Sure"
                    oncomplete="confirmation.hide()"
                    actionListener="#{gameMB.delete(gameMB.selectedGame)}"
                    update=":form1:overviewTableGame">
                </p:commandButton>
            </h:panelGrid>

            <p:commandButton id="decline" value="Not Yet"
                onclick="confirmation.hide()" type="button" />
        </p:confirmDialog>

    </h:form>

Die Delete-Methode:

public void delete(Game game) {
    //FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO,"DELETE", "Game Deleted!"));
    System.out.println("==================");
    System.out.println(game);
    getGameService().removeGame(game);
    //this.gameList = gameService.listAllGames();
}

Den selectedGame

private Game selectedGame;

public Game getSelectedGame() {
    return selectedGame;
}

public void setSelectedGame(Game selectedGame) {
    this.selectedGame = selectedGame;
}

Irgendwelche Ideen?

Dank

InformationsquelleAutor user2158143 | 2013-03-11

Schreibe einen Kommentar