Stop datepicker appearing at the bottom of a dynamic table

Stop datepicker appearing at the bottom of a dynamic table

Using ASP.NET MVC javascript to replace a table cell with a textbox and datepicker.ui control.

When the table renders, the datepicker control appears underneath the table.

Once the textbox with the bound datepicker is selected the control 'disappears' from the bottom of the table and renders correctly with the textbox.

Everything works well but how can I stop the datepicker appearing under the table?

Looking at the DOM, I notice that when the cell is clicked the datepicker 'div' style changes to include left, top, z-index. Is there any way to either stop the datepicker appearing until the textbox is clicked or to assign the appropriate style values?