jsf - Delete picture in a carousel + update -


i'v carousel possiblity update pictures (stored in db) , view them in bigger size. works fine. now, remove them. , works almost. means, picture deleted carousel not correctly refreshed. here code:

    <p:tab title="#{vms_uimsgs['vehicle.tab.images']}">      <h:form id="pictures" enctype="multipart/form-data">        <p:fileupload fileuploadlistener="#{vmsvehicleactionbean.handlefileupload}" mode="advanced" update="vehiclepicturecarousel" sizelimit="10000000" allowtypes="/(\.|\/)(gif|jpe?g|png)$/" />        <p:carousel id="vehiclepicturecarousel" var="imageid" value="#{vmsvehicleactionbean.imageids}" itemstyleclass="vehiclepictureitem" effect="fade">         <f:facet name="header" value="#{vms_uimsgs['vehicle.tab.images']}"/>         <p:panelgrid columns="1" style="width:100%" cellpadding="5">          <p:graphicimage value="#{graphicimagestore.streamedimagebyid}" rendered="#{graphicimagestore.hasimage(imageid)}">           <f:param name="id" id="id" value="#{imageid}" />          </p:graphicimage>          <p:commandlink id="deleteimage" update="vehiclepicturecarousel" oncomplete="#{vmsvehicleactionbean.deleteimage()}" title="delete picture">           <h:outputtext styleclass="ui-icon ui-icon-close" style="margin:0 auto;" />           <f:setpropertyactionlistener value="#{imageid}" target="#{vmsvehicleactionbean.selectedimageid}" />          </p:commandlink>                                </p:panelgrid>        </p:carousel>       </h:form>      </p:tab> 

or asked differently, why carousel correctly refreshed when add picture file uploader , not when remove 1 commandlink inside carousel?

of course, when reload whole page, correct. don't want that.

the problem come oncomplete="#{vmsvehicleactionbean.deleteimage()}", oncomplete attribute call javascript method when ajax have completed, should use: facelet:

 actionlistener="#{vmsvehicleactionbean.deleteimage(imageid)}" 

bean:

public void deleteimage(string imageid){ //delete here } 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -