DataTable AJAX Row Selection

UI Components for JSF
Post Reply
gdrparker
Posts: 6
Joined: 29 Jun 2010, 07:11

07 Jul 2010, 20:54

In general, I've found that most of the Primefaces components support dynamic/programatic access/mutation that mirrors the declarative functionality. Overall, I've been impressed with the level of documentation and quality of the implementation.

Here's my 'problem'...

I have programatically constructed a DataTable that is dynamically added to an HtmlForm within a Dialog. I want add support to detect selection changes. At this point, it appears I'm forced to create a backing bean and use EL / ValueExpression to update the selection. The problem is that I am completely building the views from a business model...I don't want to have backing beans at all.

The JSF framework has addressed this issue by supporting the Event-Listener pattern; specifically, EditableValueHolder components support ValueChangeEvent and the addValueChangeListener(ValueChangeListener) methods. Another example is ActionEvent and the addActionListener(ActionListener) method.

I recommend that the DataTable be enhanced to support a similar paradigm. For example, in MyFaces/Trinidad, they have the concept of a SelectionChangeEvent and SelectionChangeListeners. Even better would be to support a general mechanism of AJAX notification when ANY property changes (as is provided by the JavaBeans pattern/specification). Perhaps methods called addPropertyChangeListener(String propertyName, PropertyChangeListener listener) and removePropertyChangeListener(String propertyName, PropertyChangeListener listener).

This concept could easily be extended to other UIComponents so that Primefaces would need to provide customized versions of the common JSF UIComponents (HtmlInput, HtmlOutputText, HtmlSelectOne, HtmlSelectMany etc.). In my opinion, this would be an excellent opportunity to AJAX-ify these components so that they also support ajax=[true|false].

Just some food for thought.

By the way, if you are aware of another approach to achieve the desired result using a purely programatic paradigm, please let me know.

Cheers.
David Parker
Solution Architect
Fdata Software Inc.
PrimFaces 2.1.RC1 / JSF Mojara 2.0.2

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

08 Jul 2010, 16:07

Hi David,

Thanks for your feedback, there is a pending ticket about row select listener in datatable. This will be implemented in 2.1.1 (August)

http://code.google.com/p/primefaces/iss ... ail?id=674

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 32 guests