ajax - Redirecting with return statement influences the rendering process in next page -
i have problem rendering of datatable. in application have navigation bar:
<h:form> <ul class="nav nav-tabs"> <li class="active" role="presentation"> <h:commandlink value="veranstaltungen" action="#{eventcontroller.redirect('veranstaltung.xhtml')}"/> </li> <li role="presentation"> <h:commandlink value="beacons" action="#{beaconcontroller.redirect('beacon.xhtml')}"/> </li> [...] </ul> </h:form>
redirect (beaconcontroller):
public string redirect(string link) { beacons = database.getallbeacons(); return "./" + link; }
the navigation works perfectly, when submit form beacondata
in beacon.xhtml datatable won't rendered.
<h:form id="beaconstable"> <p:datatable value="#{beaconcontroller.beacons}" var="b" tablestyleclass="table table-striped" emptymessage="keine beacons verfügbar" style="font-size:14px" rowindexvar="rowindex" rowstyleclass="#{(rowindex mod 2) eq 0 ? 'first-row' : 'second-row'}" > <p:column style="float:left;border:none;"> <f:facet name="header"> <h:commandlink actionlistener="#{beaconcontroller.sortbeacons}"> <f:ajax execute="@this" render="beaconstable"/> beacons </h:commandlink> </f:facet> <h:commandlink> <f:ajax listener="#{beaconcontroller.fillfields(b)}" execute="@this" render=":beacondata beaconstable :delete"/> <h:outputtext value="#{beaconcontroller.getcompletestring(b)}" style="#{beaconcontroller.currentbeacon == b ? 'color:#337ab7' : 'color:#555555'}"></h:outputtext> </h:commandlink> </p:column> </p:datatable> </h:form> </div> <div class="col-lg-6"> <h:form role="form" id="beacondata" enctype="multipart/form-data"> <div class="form-group"> <label>uuid*</label> <h:inputtext id="id_uuid" binding="#{uuidattribute}" class="form-control" value="#{beaconcontroller.uuid}" p:placeholder="unternehmen" required="true" requiredmessage="bitte uuid angeben" validatormessage="bitte nur zahlen und buchstaben angeben"> <f:validateregex pattern="[0-9a-za-z]+"/> </h:inputtext> <h:message styleclass="errmessage" for="id_uuid" style="color: red"/> </div> [...] <h:commandbutton type="submit" value="speichern" actionlistener="#{beaconcontroller.savedata}" class="btn btn-primary" disabled="#{beaconcontroller.currentbeacon == null}"> <f:ajax render="beacondata :beaconstable" execute="@form"/> </h:commandbutton> </h:form> </div>
clicking on other entry in datatable, solves problem. table rendered on submit. why dosen't work on first time?
when change action="#{beaconcontroller.redirect('beacon.xhtml')}"
in navigation bar action="beacon.xhtml"
works correct. thought these expressions meaning same?
Comments
Post a Comment