By Danubian Sailor


2013-05-29 14:24:53 8 Comments

I'm using PrimeFaces version 3.5.

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

I've tried to do it with both Messages and outputText. I set the text to display and request update:

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

The components:

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

However, I don's see the proper update sections in partial-request response. Is it possible to request the update of components from within the LazyDataModel.load function (and if, what I'm doing wrong here)? If it is not possible (why?) how else can I force refresh of element from DataTable filtering?

1 comments

@Danubian Sailor 2013-05-31 11:51:00

The load method of LazyDataModel is invoked in render phase, when it's too late to add additional components to update.

However, it is possible to add JavaScript execution command:

context.execute("show_message()");

Where function show_message will display the message on client side, which enables to accomplish the task with single request.

@jimmybondy 2013-08-20 14:49:56

can you show us an example for your short_message() function. Does it use the widgetVar attribute of p:message to update the component? Also where have you placed the context.execute() command: At the end of the load method?

@Danubian Sailor 2013-08-20 14:53:31

@jimmybondy the place doesn't matter, because it puts the javascript into collection, which is processed after the method is loaded. The method sets the display attribute of the span containing message, so it's quite trivial, no PrimeFaces things at all.

@jimmybondy 2013-08-20 16:05:55

Thank You. Works fine for me.

Related Questions

Sponsored Content

1 Answered Questions

[SOLVED] Primefaces DataTable filtering warning

  • 2013-10-01 13:10:18
  • Cold
  • 4960 View
  • 3 Score
  • 1 Answer
  • Tags:   primefaces

1 Answered Questions

Primefaces fileupload update attribute does not rerender datatable

  • 2018-07-03 16:14:58
  • romanian82
  • 142 View
  • 0 Score
  • 1 Answer
  • Tags:   jsf primefaces

1 Answered Questions

2 Answered Questions

3 Answered Questions

5 Answered Questions

[SOLVED] How to trigger component refresh from javascript in primefaces?

  • 2012-05-17 09:15:54
  • Mark Estrada
  • 76539 View
  • 27 Score
  • 5 Answer
  • Tags:   jsf jsf-2 primefaces

2 Answered Questions

[SOLVED] Primefaces - custom component for live filtering in dataTable

0 Answered Questions

2 Answered Questions

[SOLVED] I can't update from within a facet

  • 2012-08-16 13:17:05
  • Rick
  • 2323 View
  • 0 Score
  • 2 Answer
  • Tags:   jsf-2 primefaces

1 Answered Questions

[SOLVED] Can I control the order of JSF2 partial render update processing?

Sponsored Content