[Tex/LaTex] Subcaption, subtable change the format of reference

cross-referencingsubcaption

I am using subcaption to support multiple part tables (subtables).
The current reference format is Table 1a, I would like parentheses instead: Table 1(a).

I saw this question and the offered solution didn't work for me. It seems that the solution which is adding the following options only works for the figure and subfigure floats:

\usepackage[labelformat=simple]{subcaption}
\renewcommand\thesubfigure{(\alph{subfigure})}

Is there anyway I can correct the format of references to the subtables? Below is a minimal working example:

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage[labelformat=simple]{subcaption}
\renewcommand\thesubfigure{(\alph{subfigure})}

\usepackage{hyperref}


\begin{document}

\begin{table}[t]
    \begin{subtable}[b]{.49\textwidth}\centering
 %      \includegraphics[width=.9\textwidth]{myPicture}
        \rule{2cm}{2cm}.
        \caption{SubText 1}\label{subtab:p1}
    \end{subtable}
    \begin{subtable}[b]{.49\textwidth}\centering
        \rule{2cm}{2cm}.
        \caption{SubText 2}\label{subtab:p2}
    \end{subtable}
    \caption{Description referencing to \subref{subtab:p1} and
  \subref{subtab:p2}}\label{tab:1}
\end{table}

Table \ref{tab:1} has two parts \ref{subtab:p1} and \ref{subtab:p2}.
    
 
\end{document}

enter image description here

This shows the references and the labels incorrectly. The subcaption lables do not have parenthesis anymore and the references are still like 1a and 1b.

Best Answer

Like this?

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{subcaption}
\DeclareCaptionSubType * [alph]{table}
\captionsetup[subtable]{labelformat=simple, labelsep=space}

\renewcommand\thesubtable{\thetable(\alph{subtable})}

 \usepackage{hyperref}
\begin{document}

\begin{table}[t]
    \begin{subtable}[b]{.49\textwidth}\centering
 % \includegraphics[width=.9\textwidth]{myPicture}
        \rule{2cm}{2cm}
        \caption{SubText 1}\label{subtab:p1}
    \end{subtable}
    \begin{subtable}[b]{.49\textwidth}\centering
        \rule{2cm}{2cm}
        \caption{SubText 2}\label{subtab:p2}
    \end{subtable}
    \caption{Description referencing to \ref{subtab:p1} and
  \ref{subtab:p2}}\label{tab:1}
\end{table}

Table \ref{tab:1} has two parts \ref{subtab:p1} and \ref{subtab:p2}.

\end{document} 

enter image description here