action_url = (
  viewname,
  table,
  action_name,
  r,
  colId,
  colIdNm,
  confirm,
  colIndex
) => {
  const pk_name = table.pk_name;
  const confirmStr = confirm ? `if(confirm('${"Are you sure?"}'))` : "";
  if (action_name === "Delete")
    return {
      javascript: `${confirmStr}${isNode() ? "ajax" : "local"}_post_btn('${
        !isNode() ? "post" : ""
      }/delete/${table.name}/${r[pk_name]}?redirect=/view/${viewname}', true)`,
    };
  else if (action_name === "GoBack")
    return {
      javascript: isNode()
        ? "history.back()"
        : "parent.saltcorn.mobileApp.navigation.goBack()",
    };
  else if (action_name.startsWith("Toggle")) {
    const field_name = action_name.replace("Toggle ", "");
    return `/edit/toggle/${table.name}/${r[pk_name]}/${field_name}?redirect=/view/${viewname}`;
  }
  return {
    javascript: `${confirmStr}view_post('${viewname}', 'run_action', {${colIdNm}:'${colId}'${
      r ? `, ${pk_name}:'${r?.[pk_name]}'` : ""
    }${columnIndex(colIndex)}});`,
  };
}
@param {string} viewname
@param {Table|object} table
@param {string} action_name
@param {object} r
@param {string} colId
@param {string} colIdNm
@param {string} confirm
@param {number|undefined} index
@returns {any}