Request component update using ajax from LazyDataModel.load?

I am using PrimeFaces version 3.5.

I want to implement a message informing that the filter in the DataTable returns too many rows and only the first 50 will be displayed.

I tried to do this with both posts and outputText. I set the text to display and request the update:

RequestContext context = RequestContext.getCurrentInstance(); context.update("form:message"); context.update("form:text"); message = "Too many rows"; 

Components:

 <p:message id="message" for="message"/> <h:outputText id="text" value="#{userPicker.model.message}"/> 

However, I do not see the correct update sections in the partial request response. Can I request component updates from the LazyDataModel.load function (and if, what am I doing wrong here)? If this is not possible (why?), How else can I force an element to be updated from DataTable filtering?

+1
source share
1 answer

The load LazyDataModel method is called during the render phase when it is too late to add additional components for the update.

However, you can add the JavaScript execution command:

 context.execute("show_message()"); 

If the show_message function displays a message on the client side, allowing you to complete the task with a single request.

+5
source

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


All Articles