primefaces - p:dataTable not updated after calling portlet .setEvent( , ) from the same .xhtml -
my primefaces datatable not updated after calling portlet.setevent() same xhtml. once pageload, calls init() method fetch data. when refresh page browser refresh, call init() again. however, once trigger method .setevent (e.g. retrievefilesname(fi06jfolderdto folder)) dtable.xhtml, when go dtable.xhtml, not call init() method. need datatable updated reflect newly created folders. below codes:
dtable.xhtml
<p:datatable id="dt" var="folder" value="#{viewclassifolderbean.listfolders}" paginator="true" styleclass="pordatatable"> <p:column filterby="#{folder.foldername}" headertext="folder" filtermatchmode="contains" sortby="#{folder.foldername}" style="text-align: center;"> <p:commandlink value="#{folder.foldername}" id="viewbtn" actionlistener="#{pc_fi06rviewclassifoldersview.retrievefilesname(folder)}" ajax="false"></p:commandlink> </p:column> <p:column headertext="" width="20%"> <p:commandbutton icon="ui-icon ui-icon-upload" id="uploadfilebtn" value="upload files" styleclass="porprimarybutton" actionlistener="#{pc_fi06rviewclassifoldersview.uploadfiles(folder)}" ajax="false" /> </p:column> </p:datatable>
retrievefilesname()
public list<fi06jfiledto> retrievefilesname(fi06jfolderdto folder){ try{ portletresponsewrapper responsewrapper = (portletresponsewrapper) (getfacescontext() .getexternalcontext().getresponse()); actionresponse actionresponse = (actionresponse) (responsewrapper .getportletresponse()); actionresponse.setevent("viewfolderfiles", folder); }catch(exception ex){ logger.info("retrievefilesname error:"+ex); } return listfiles; }
viewclassifolderbean.java
@requestscoped private list<fi06jfolderdto> listfolders; //other variables, getters , setters @postconstruct public void init() { try{ managefilesbean=new fi06bmanagefilesbean(); listfolders = managefilesbean.retrievelistfolders(); logger.info("#folders8:"+listfolders.size()); }catch(exception ex){ logger.info("init() error:"+ex); } }
Comments
Post a Comment