Page 1 of 1

creating a context menu in a grid

Posted: Wed Jul 11, 2012 10:36 am
by dieter
Hello,

we created a context menu in a subfile grid. When the user right clicks on a row, the context menu appears. Now we have the problem to recognize on which row the user has clicked. Our idea is to create an java script which sets a variable to the number of the actual row: changeElementValue("sflrow",row); This java script hangs at the "onrowclick"-property of the grid. Is this the only way to do this? Our problem is that we "loose" the left-click event. We would like to give the user the option to left click on a row (this event shall show details) or to right-click on a row (this event shall show the context menu).
Is there a way to to this?

Dieter

Re: creating a context menu in a grid

Posted: Mon Jul 16, 2012 6:51 pm
by Antonio
Hello,

You can bind the "menu response" for the context menu to an RPG variable, and you can bind the "cursor record number" property for the subfile grid as well to RPG variable as well. This should give you all the information you are seeking. Let me know if you have any more questions or issues.

Thanks!

Re: creating a context menu in a grid

Posted: Tue Jul 17, 2012 7:58 am
by dieter
Many thanks for your answer. It works fine. But i still have two questions: When a subfile row is clicked, there is no automatic round trip to the server. I solved this problem by setting a "pui.click()" on the "onrowclick" event. Is this the correct method to do this? My other question is the following: In our subfile we show insurance contracts. A customer e.g. has a contract for a car insurance and a contract for a house insurance. Depending on what kind of contract is clicked we wish to fill the context menue. Is there a (simple) way to do this?

Please excuse my bad english. I am from Germany.

Dieter

Re: creating a context menu in a grid

Posted: Tue Jul 24, 2012 7:15 pm
by Antonio
Hello,

The pui.click is the correct way to make a round trip to the server. For your second question, you can use the applyProperty in the onrowclick event.

Example:
applyProperty("Menu1", "choices", "one,two,three");
applyProperty("Menu1", "choice values", "1,2,3");

Thanks!