Drop down menu in primefacess - jsf

Using primefaces, how can i implement multiple selection of items in the dropdown list without using several dropdown menus...
is there tag in primefaces??

I think there's no primefaces component to achieve this but you can use plain jsf.
Try <h:selectManyMenu> or <h:selectManyListbox>.
Here is an example for the menu:
<h:selectManyMenu
id="newsletters"
value="#{bean.selectedItems}">
<f:selectItems
value="#{bean.availableItems}"/>
</h:selectManyMenu>
You'll find more information in the Java EE tutorial.

Primefaces 3.0 M1 has a SelectManyMenu component. You can download 3.0 M1 version here
2.2.1 doesn't have such component. Regards.

Related

Alternative to rich:extendedDataTable in PrimeFaces 6.1

We are currently migrating our application which was written in richfaces to primefaces.
I am looking for alternative for rich:extendedDataTable in primefaces. the extended data table does something like this
is there a way to achiveve this in primefaces with p:dataTable?
From looking over the RichFaces ExtendedDatatable I think the PrimeFaces Extensions Sheet component is what you are looking for. From what I can see it does almost everything that Extended Datatable does except Live Scroll.

JSF: selectOneListBox with checkboxes

Is it possible to create a selectOneListBox with checkboxes? And if so, how to do this or what would be the best approach? I do not want to do this using Primefaces, I only have license to Richfaces atm.
<h:selectOneListBox>
............
</h:selectOneListBox>
Thank you in advance.

How to call bean method when drag-drop the element using <p:pickList>?

I am using primefaces 3.3 library for jsf based application.
I am using <p:pickList> to handle drag and drop the element from source to target and vide versa.
I want to call the jsf bean method when element transferring(by drag-drop ) from source to target and vice versa and handle some logical things there.
I follow the link PrimeFaces showcase for pickList to implement my functionality. This is the version 5.2.7.
In primefaces 5.2.7 it can be easily done by <p:ajax event="transfer" /> , but how can I achieve this using primafaces 3.3.
I try valueChangeListener attribute but it is not working.
There is one attribute called onTransfer , but it is for clientSide callback.
This can be achieve by putting submit button. But I want to achieve it on drag and drop. So how can i do that ?
Thanks in advance.
First, you should consider an update of your primefaces version. Updates are not only provided for new features but also for bug fixes, improvements (performance, stability) etc.
Currently I cannot find the documentation for 3.3, but what you could try is using p:remoteCommand (its in the 3.5 documentation, so maybe available):
use onTransfer="submitToBean()" along with a p:remoteCommand that might look like this:
<p:remoteCommand
name="submitToBean"
action="#{myBean.doSomething}"
process="idOfYourPickList"
partialSubmit="true" />
Then the onTransfer Event will call the javascript method submitToBean() which in turn will process your picklist and call the action method.

What is an alternative of a4j:JsFunction in JSF 2.0?

I am new to JSF 2.0.
My current project is build on JSF 1.3 and Richfaces 3.3.
We are trying to migrate to JSF 2.0.
There is limitation to not use Richface 3.3 or 4.0 in Current Project or any third party tool/library. Our goal is to only use JSF 2.0 functionality/feature.
In my project there is lot of use of
<a4j:jsFunction data="action" oncomplete="JavaScriptFunction(data); >
<a4j:actionaram name="nm" assignTo="#beanName.methodName"> </a4j:actionparam>
</a4j:jsFunction>
I want to remove this type of a4j:jsFunction with h:commandButton or
any jsf 2.0 standard mechanism.
I am not able to find out best way to call Bean function which return some value and assign this return value to JavaScript function.
JSF 1.3? I thought 1.2 was the latest?
On to your question. The idea to only use JSF 2.x is invalid and you should have the decision maker reconsider because skimping on OmniFaces will impede your productivity and the general code quality.
The way I see it you have three choices:
OmniFaces
Click button with display:none using javascript. Said button can have f:ajax as a child
Rip o:commandScript http://showcase.omnifaces.org/components/commandScript it's open source.
I can fully understand that a company today says no to Primefaces or Richfaces and honestly I would recommend it for many applications. Omnifaces however is to be seen as a proper for JSF.

How do I reorder rows in DataTable using drag drop?

I am using PrimeFaces and JSF. Can anyone tell me how do I reorder rows of a DataTable using Primefaces drag and drop component?
Currently with in the PrimeFaces framework (v2.2.1 and 3.0) this is not possible with <p:dataTable>.
There is an open PrimeFaces Issue 511 <p:dataTable> draggable columns to add the Yahoo widget datatable draggableColumns attribute to the PrimeFaces <p:dataTable> but no target version is set yet.
If you would like to see this added to PrimeFaces star the issue to help give it higher priority.
This is definitely an older question, but the answer needs updating. This is now doable using the draggableColumns="true" attribute on your p:dataTable.
Your dataTable would then look as such :
<p:dataTable var="i" value="#{bean.data}" draggableColumns="true">
Sources :
PrimeFaces Showcase : DataTable - Columns Reordering
This feature is now available from PrimeFaces 5.0:
Usage is very simple by just enabling draggableRows option and also an optional rowReorder ajax behavior is provided getting a ReorderEvent with index information for flexibility.
Source : http://blog.primefaces.org/?p=3026
You can also have a look at the showcase here: http://www.primefaces.org/showcase/ui/data/datatable/reorder.xhtml

Resources