cancel
Showing results for 
Search instead for 
Did you mean: 

TableView click cell calling specific event method with parameters

Former Member
0 Kudos

Hello,

In JSPDynPage, I have data displayed in a tableView object.

I need to have clickable cells (as links or clicks cell ...) which allow me to call a specific method of my process with some parameters and to display the result in a new window.

Is it posible to do this?

What can I use to do this?

I have tried with link inside my TableView but I do not think how to call a method of my process and how to get back parameters.

I have tried with setOnCellClick but I do not find how to pass parameters and how to open in a new window.

Thanks,

Fabien

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

I would normally implement this in the following manner, in the bean which populates the Table view,

<b>TableColumn column = model.getColumn("Link_column");

column.setEncode(false);</b>

This step allows me to use ordinary html tags for the column that populates.

Now where I am populating the tableview,for example,

<b>Vector data = new Vector();

data.addElement("coldata1");

data.addElement("coldata2");

data.addElement("<a href=# onClick="javascript:window.open('url')">text</a>

....</b>

This way I can open the component in a new window.

I can append the paramaters to the url.The onClick method can also be made to call a javascript function whhich will set parameters .

Based on the parameters I can decide which method to call.

Regards,

Harish

(Please award points for helpful answers)

Message was edited by: HARISH SUBRAMANIAN

Former Member
0 Kudos

Hello Harish,

Thanks, for your response.

I've tried this solution. The problem was that using URL does not allow us to call a specific function event.

This is the <b>doInitialization</b> method which is called everytime, right ?

Then you use on URL parameters to "dispatch" to the good method.

But I wonder if it was the good way to do such a think ...

Do you confirm that it is the good way to do this ?

Thanks,

Fabien

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

I dont see any drawbacks if you are calling the url in a new window,as in any case doInitialization would have been called.

Now one way to pass parameters in a url is

"url?id=2&val1=3"

In your component you will have to retrieve the parameters in the following manner,

request.getParameter("parameter_name");

(If you cannot retrieve the parameter values in this way,let me know,I can look up on some code developed and confirm)

So,as you will any way be calling the Component in a new window(In fact you can also create a different component which will only be responsible for the results displayed on the new page,based on the parameters passed),I see no issues at all.I have done some implementations like this successfully

Regards,

Harish

(Please award points for helpful answers)

Message was edited by: HARISH SUBRAMANIAN

detlev_beutner
Active Contributor
0 Kudos

Hi Fabien,

if you use setOnCellClick, a TableCellClickEvent gets thrown (which you receive in the handler method; you can just cast the Event to this). From this, you can call getVisibleColIndex() and getVisibleRowIndex(), see http://portal.dk.issworld.com:50000/irj/portalapps/javadocs/htmlb/com/sapportals/htmlb/event/tablece...

If you know the cell on server side, you shouldn't need parameters to pass for you could calculate everything needed on the event itself.

Anyhow, with an event on the cell you cannot open a new window immediately. But you could render JS into the result page opening a window.

The alternative would be to use a link and for example open the window via onClientClick per JS.

Hope it helps

Detlev