performance - How to decrease request payload of p:ajax during e.g. p:dataTable pagination -


i using jsf 2.2 primefaces 5.1. there editable primefaces datatable pagination enabled.

            <p:datatable editmode="row"                           editable="true"                           value="#{usersbean.users}"                           var="user" paginator="true" rows="20">                  <p:ajax event="roweditinit" onstart="handleroweditinit(event,this);"/>                  <p:column>                     <p:roweditor/>                 </p:column>                 <p:column headertext="real name">                     <p:celleditor rendered="true">                         <f:facet name="input">                             <p:inputtext value="#{user.realname}"/>       </f:facet>                             <f:facet name="output">                                 <h:outputtext value="#{user.realname}"/>                             </f:facet> </p:celleditor>                 </p:column>                 <p:column headertext="user name">                     <p:celleditor>                         <f:facet name="input">                             <p:inputtext value="#{user.username}"/>                         </f:facet>                         <f:facet name="output">                             <h:outputtext value="#{user.username}"/>                         </f:facet>                     </p:celleditor>                 </p:column>             </p:datatable> 

every time page changed datatable ajax post data of current page. can partly see in image below.

enter image description here

for big tables data results in huge requests. not neccessary right? there way change behavior?

indeed, when submit form in html, default every single html input element sent request parameter. primefaces ajax components therefore offer partialsubmit="true" attribute send only html input elements covered process attribute, defaults in <p:ajax> @this , in <p:commandxxx> @form.

so, add data table in case optimize pagination performance:

<p:ajax event="page" partialsubmit="true" /> 

and add command button needs access current row in data table (e.g. show in dialog) optimize action processing performance:

<p:commandbutton ... process="@this" partialsubmit="true" /> 

you can configure globally via below context param in web.xml:

<context-param>     <param-name>primefaces.submit</param-name>     <param-value>partial</param-value> </context-param> 

and cases need full submit, explicitly use partialsubmit="false".


Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -