I have a table that has rows of transactions, i select one of the rows and want to populate other data fields on the UI with the values of column data of the selected row:
here is my xhtml and backing bean code with which i am trying to achieve this:
<ice:rowSelector value="#{entry.selected}" selectionListener="#{ManualActivity1Bean.selectionListener}" enhancedMultiple="true" multiple="true" toggleOnInput="false" dblClickDelay="200" preStyleOnSelection="true" />
//row selection event handler method
public void selectionListener(RowSelectorEvent event) {
System.out.println("Selected Row is: "+event.getSelectedRows());
int rowNum = event.getRow();
Map selectedTransaction = transactions.get(rowNum);
((Map)getData().get("ManualTransaction")).put("Branch", selectedTransaction.get("Branch"));
((Map)getData().get("ManualTransaction")).put("TotalTxnAmount", selectedTransaction.get("TotalTxnAmount"));
((Map)getData().get("ManualTransaction")).put("DateOfTxn", selectedTransaction.get("DateOfTxn"));
((Map)getData().get("ManualTransaction")).put("RecordID", selectedTransaction.get("RecordID"));
((Map)getData().get("ManualTransaction")).put("CardNo", selectedTransaction.get("CardNo"));
((Map)getData().get("ManualTransaction")).put("MerchantName", selectedTransaction.get("MerchantName"));
((Map)getData().get("ManualTransaction")).put("Currency", selectedTransaction.get("Currency"));
((Map)getData().get("ManualTransaction")).put("OtherBank", selectedTransaction.get("OtherBank"));
((Map)getData().get("ManualTransaction")).put("TieUp", selectedTransaction.get("TieUp"));
System.out.println("ManualTransaction: "+getData().get("ManualTransaction"));
//System.out.println("Selected Row TxnAmount: "+selectedTransaction.get("TotalTxnAmount"));
}
i can see in the sysops that data is written to the desired data in the bacing bean but its not reflecting on the UI.
Here is what is needed to achieve this:
Edit the rowSelector tag in xhtml and include immediate="false" as shown below:
<ice:rowSelector value="#{entry.selected}" selectionListener="#{ManualActivity1Bean.selectionListener}" immediate="false" enhancedMultiple="true" multiple="true" toggleOnInput="false" dblClickDelay="200" preStyleOnSelection="true" />