PrimeFaces model lazidata loading method is not called

I do not understand why my loading method is not called in the lazydatamodel of the myfaces table. My xhtml page is as follows

<h:form id="myForm"> <p:dataTable value="#{myBean.configDataModel}" id="configTable" var="config" paginator="true" rows="10" selectionMode="single" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="5,10,20"> . . </h:form> 

My Bean code is similar to this and exposes system.out.println instructions, but I noticed that it is not being called.

 public class MyBean{ // private List<MyBean> configList; private LazyDataModel<MyBean> configDataModel; @SuppressWarnings("serial") public LazyDataModel<MyBean> getConfigDataModel() { if (configDataModel == null) { configDataModel = new LazyDataModel<MyBean>() { @Override public List<MyBean> load(int arg0, int arg1, String arg2, SortOrder arg3, Map<String, String> arg4) { System.out.println("Here!!!!!"); return null; } }; } return configDataModel; } public void setConfigDataModel(LazyDataModel<MyBean> configDataModel) { this.configDataModel = configDataModel; } } 

What could be the reason?

+4
source share
2 answers

Starting with PrimeFaces 3.3, you need to explicitly set the lazy attribute of the repeating component to true in order to enable LazyDataModel support.

 <p:dataTable ... lazy="true"> 

See also:

+19
source
  • If you are IE, be sure to check which so-called "compatibility mode" it distorts. I had very annoying problems with a lazy datatable that didn't call its load method after entering text in the filter field. After a long time, I realized that the browser works in default mode 7. Datatable lazy load works for modes 8, 9, 10
  • If your lazy datatable is in the dialog box, do not forget to put the dialog on the form, otherwise the input of the values ​​in the filter field will not be passed to the upload method.
0
source

Source: https://habr.com/ru/post/1444241/


All Articles