Dropdown action menu on table rows

Dropdown action menu on table rows

How do I go about constructing a action menu which will be a dropdown when user clicks on the table row? I would like to dynamically construct the menu based on the row user selected/clicked and position the menu as a dropdown on the row.

Any pointers on how to position the menu or links to tutorials is much appreciated.

Thanks!