This content has been marked as final.
Show 3 replies
-
1. Re: rich:extendedDataTable - How to pop up an alert upon selecting a row
ilya_shaikovsky Jun 2, 2010 3:46 AM (in response to shanikaweerapperuma)as simple solution - you could add your message as FacesMessage to context in your action. Then define modalPanel with rich:messages inside and define oncomplete on button which will execute modal opanel call if facesContext.maximumSeverity returns not null.
-
2. Re: rich:extendedDataTable - How to pop up an alert upon selecting a row
ufonaut Jun 2, 2010 9:31 PM (in response to shanikaweerapperuma)I had just the same problem recently. If you can add a message property to your bean, and simply generate your final message (including displayed properties) in your method, then you can simply put it in your oncomplete method.
eg:
{code}
private ArrayList<RVersion> selectedItems = new ArrayList<RVersion>();
private SimpleSelection selection = new SimpleSelection();
private String message = "";
public String getMessage() {
return message;
}
public String takeSelection() {
selectedItems.clear();
Iterator<Object> iterator = getSelection().getKeys();
while (iterator.hasNext()) {
Object key = iterator.next();
RVersion selectedR = todo.get(Integer.parseInt(key.toString()));
if (selectedR.getStatus() != "Pending" || selectedR.getStatus() != "Review"){
message = "Invalid row selected for this operation.";
selection.removeKey(key);
return "";
}
selectedItems.add(todo.get(Integer.parseInt(key.toString())));
}
return null;
}
{code}
And in the page:
{code:xml}
<a:support event="onselectionchange" action="#ToDo.takeSelection}"
oncomplete="if ('#{ToDo.message}' != '') { alert('#{ToDo.message}') };"
{code} -
3. Re: rich:extendedDataTable - How to pop up an alert upon selecting a row
shanikaweerapperuma Jun 10, 2010 9:38 PM (in response to ufonaut)thanks Rob. This is what I exactly did and it works fine.