using ajax and primefaces orderList component


I have 2 inputTexts, a Add button and an p:orderList component.

The scenario: I insert a text into intpuntText1, I insert a text into inputText2, I press Add and inputText1's value concatenated with ; and concatenated with inputText2's value shoud get into my p:orderList component.

The goal: How to use p:ajax to make it work?

I have not used p:ajax and neither p:orderList before.


You have to concatenate the values of the two inputTexts in your managedBean then add the result in a list of String that you will put in the p:orderList, then update the p:orderList

<p:inputText id="value1"  value="#{managedBean.value1}"  />
<p:inputText id="value2"  value="#{managedBean.value2}"  />

You can use p:ajax in commandButton to triger a the concat method when you click, you make sure to update the orderList

<p:commandButton type="button" value="Concatenate" >
    <p:ajax event="click" update=":orderList" listener="#{managedBean.concat()}"  />

then the p:orderList :

<p:orderList id="orderList" value="#{managedBean.orderList}" var="value" itemValue="#{value}">
        <h:outputText value="#{value}" />

the concat method will in the managedBean as follows:

private String value1, value2;
private List<String> orderList;

public void concat(){

Example of the correct usage:

Get the cursor of your QTextEdit

QTextEdit *editor = new QTextEdit();
QTextCursor cursor(editor->textCursor());

Set up your different QTextCharFormat

QTextCharFormat plainFormat(cursor.charFormat());

QTextCharFormat headingFormat = plainFormat;

QTextCharFormat emphasisFormat = plainFormat;

Now insert text in the text edit using different formats

cursor.insertText(tr("Character formats"),

cursor.insertBlock(); // Single character
cursor.insertText(tr("a"), emphasisFormat);
cursor.insertText(tr("b"), headingFormat);

cursor.insertText(tr("Text can be displayed in a variety of "
                              "different character formats. "), plainFormat);
cursor.insertText(tr("We can emphasize text by "));
cursor.insertText(tr("making it italic"), emphasisFormat);

If you want to change the style of a editable widget in real time of just render a text with different styles, you have an example in this url: Syntax Highlighter Example

I think you could rewrite this as a single query on the status table, using ORs to test each scenario, like so:

SELECT ss.int_tran_id
FROM   status SS
WHERE  ss.stage in ('ACHPayment_Confirmed', 'HIFV4', 'HIFV5_FTRINF', 'Payment_HIFV5_FTRINF')
OR     (ss.stage = 'PREVDAY'
                     FROM   references rf
                     WHERE  ss.int_tran_id = rf.int_tran_id
                     AND    rf.mid_ref IS NOT NULL)
                        FROM   app_data ad
                               INNER JOIN ach aa
                                 ON (ad.app_data_id = aa.ach_id)
                        WHERE  ss.int_tran_id = ad.int_tran_id
                        AND    aa.par_number IS NOT NULL)));
By : Boneist

This video can help you solving your question :)
By: admin