How to identify which commandLink was clicked? [SOLVED]
Leigh Taylor
Greenhorn
Joined: Feb 19, 2008
Posts: 20
posted
0
Hi,
I have recently jumped into the land of jsf and am trying to absorb everything there is. I have run into an issue where i have a number of commandlinks being produced within a dataTable. Each command link calls the same javaScript method. How can i parse information so the javascript method knows which link was clicked?
I have no idea who to tackle this issue. I have a hidden variable so i can access all the address matches. Though how do i know which link is clicked?
Thanks [ February 25, 2008: Message edited by: Leigh Taylor ]
Bob Good
Ranch Hand
Joined: Jan 09, 2008
Posts: 86
posted
0
Maybe you could set a hidden field or a variable to a unique value from each link onmousedown.
Or have each link call different javascript, that each in turn call a common javascript function.
I do not know why you are using javascript for an action method instead of server side java code, but I have not used a4j.
Leigh Taylor
Greenhorn
Joined: Feb 19, 2008
Posts: 20
posted
0
Thanks for the reply Bob. As i was generating the links dynamically it wasn't possible to include individual javaScript methods.
I did however work out a solution. The problem being my limited knowledge of binding.
Simply added a binding attribute to the datatable and bound it to the backing bean.
So the link calls the java method and the method then grabs the row data which i re-injected into my JSP page on reRender.
Leigh
subject: How to identify which commandLink was clicked? [SOLVED]