Primefaces MultiSelectListBox - jsf

Is there a way to get SelectItemGroup values so that the entire trace of the SelectItem is contained in the value passed to the bean from the view? I have two SelectItemGroups and one SelectItem, but need the values contained in the SelectItemGroups as well.

It does not seem this is possible but would be a great feature. I used a Datatable instead but the MultiListBox would have been more elegant.

Related

JSF input component for string lists?

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.
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.
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.

Is there a JSF component that supports autocomplete and can hold multiple values?

I'm developing an application in JSF 2.0.
I was wondering if there is a JSF component that supports an autocomplete function and that can hold multiple values (that binds to an array or a list). I don't have the time and knowledge to create such a component myself.
I know PrimeFaces has got the p:autoComplete (http://www.primefaces.org/showcase-labs/ui/autoCompletePojo.jsf) component, but it can only 'hold' one value. I'd need a component that can do what p:auotoComplete does, but multiple times; the textarea should be able to display multiple values. Is there a library that contains such a component?
Any help would be greatly appreciated.
The latest PrimeFaces snapshot 3.1 got AutoComplete - Multiple Selection
You can get it from here
3.1-SNAPSHOT
You might see this Richfaces example. I think that tokens and autoFill = "false" will work.

Custom components in JSF - what about sub-components (children)

When Im creating custom component in JSF do I have to create all sub-components in that same way?
For example:
h:dataTable component use h:column to determinate column parameters
Now if I want to create dataTable component do I have to implement in that same way a column component?
(PS. "that same way" mean:
create DataTable class extends i.e. UIOutput
create DataTableTab class extends UIComponentELTag
append configuration to
custom.taglib.xml
In general the answer is no. If you create a complex component like a datatable, it can simply take advantage of the existing components for defining columns.
As the designer of such a dataTable, you are the one who determines what's needed. The standard column afaik has no knowledge of the dataTable, but the dataTable has knowledge about the columns.
Also note that you don't often need to create tag classes. This is only needed for JSP compatibility, but as JSP is deprecated I would advise you to not support it unless you really have to.

use Label and Value of f:selecteItems with rich:combobox

How can i display Label from SelecteItem and use the value as a Key in rich:combobox? Jboss forums says it is not possible since the rich:combobox is designed for suggestion. Not really a replacement for h:selectOneMenu . is there any work around or alternative way?
PS: i tried using JSF converter it is modifying both value and label.
no.
use selectOneMenu.
add a4j:support as a child if you want ajax.

Sorting panelgrid JSF

Can we sort values in column of a panelGrid. If yes, can I see an example
Rather use h:dataTable to represent a dynamic table which is backed by a List<RowObject>, wherein RowObject is basically just a Javabean (DTO - Data Transfer Obejct, VO - Value Object, whatever you call it :) ) representing a single row.
Such a List can be sorted using Collections#sort(). All you need to do is to implement a Comparator which takes care about the ordering. Then in the JSF page just have a bunch of buttons or links which calls Collections#sort() on the List. Those buttons/links just have to pass the sortfield along.
You can find here a basic example: http://balusc.blogspot.com/2006/06/using-datatables.html#SortingDatatable
No, you can't. <h:panelGrid> = <table>
If you want sorting, look at Richfaces or another component framework (Icefaces, primefaces, trinidad, tomahawk, etc). There are <x:dataTable> components there which allow sorting on their <x:colum>.

Resources