1

I'm looking for a ready made, freely available component that provides the following features:

  • editing list entries
  • deleting entries
  • adding a new entry - possibly invoked multiple times
  • bind to property in managed bean of type List, or similar
  • optional: reordering entries
  • optional, simple: allow verification that at least one element is entered (required="true"? required="1"?)
  • optional, better: restrict by minimum and maximum allowed number of elements

The simplest way to allow editing entries would be to represent them as input element. Preferably the element won't need to sync to the server for every change in the number of elements.

Alternatively: is there a trivial way to create or compose such a component oneself?

If this if of importance: currently I'm using Richfaces 3.3.3 and MyFaces 2.0.

Edit: The component is expected mostly to be used for creating new lists from scratch, so that should be as simple for the user as possible. Preferably just tabbing to the next empty input element automatically created at the end of the list. I'd like to use the component for editing these lists, too, but that feature is expected to be used much less often.

2 Answers 2

2

You could take a look at Primefaces p:collector. The example in the Primefaces showcase is a good starting point. It can be used for adding elements to a list and for editing and removing these elements.

Sign up to request clarification or add additional context in comments.

1 Comment

I can't get primefaces to work right now, but p:collector seems to be what I'm looking for. Thanks.
1

Probably the simplest way that I would know of going about almost all of these is the PrimeFaces dataTable component. With the exception of adding and deleting entries inline, all of this comes out of box. Deleting entries can be as simple as adding a delete button in a row and adding entries can be done through invoking a modal dialog with a form to create a new entry, add it to the backing bean list for the table, then asynchronously updating the dataTable.

http://www.primefaces.org/showcase/ui/datatableHome.jsf

It really does seem to be the most fully featured JSF dataTable component out there.

1 Comment

Thank you for your suggestion. It seems dataTable is more intended to displaying tables (or lists), but I'm rather looking for a component that lets users create new lists. And in some cases to edit their lists. I'm going to edit the question to indicate that. Sorry that I didn't put it in the question earlier. But Primefaces' dataTable is a good suggestion. I can't vote up yet and before accepting your answer I'd like to wait for other answers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.