Pushing Podio

Mobile Friendly Markdown Tables

Power users of Podio know the power of markdown in calculation fields. You can summarize all sorts of data and even present it in a nice tabular fashion.

For example, here’s a little calc field to summarize related items:

Pretty, right? You can even click on the items to navigate there.

But in the mobile app (Android especially), this no longer looks good:


Part 1 - Hide the Table

The first thing we’re going to do to address this, is to make this calculation field with the table an always-hidden field.

Then we’re going to create a little HTML widget in ProcFu to, given the item’s app_item_id (or @Unique ID), show the table in a browser window instead.

// show an external presentation of a markdown table from a calc field
// makes for better mobile experience
// calc: "[Table Link](https://procfu.com/widgets/html/XXXXXXX?id="+@Unique ID+")"

// config
$app_id = 111111;
$calc_field_id = 222222;

// templates
$window_closer = '<script>window.close();</script>';
$style = '<link rel="stylesheet" href="https://unpkg.com/purecss@1.0.0/build/pure-min.css" />';
$style .= '<meta name="viewport" content="width=device-width, initial-scale=1">';
$style .= '<style> table { width: 100%; max-width: 500px; } ';
$style .= 'table td, table th { padding: 4px 10px; } ';
$style .= 'table td:last-child, table th:last-child { text-align: right; } </style>';

// url params
$id = intval(@json_decode($pf_payload, true)["GET"]["id"]);
if ( $id <= 0 ) return $window_closer;

// get the item
$item = @json_decode(call_pf_script("podio_app_item_get_raw.pf", ["app_id" => $app_id, "app_item_id" => $id]), true);
if ( ! is_array($item) || sizeof($item) == 0 ) return $window_closer;

$value = "";
foreach ( $item['fields'] as $field ) {
    if ( $field['field_id'] == $calc_field_id ) $value = $field['values'][0]['value'];
if ( empty($value) ) return $window_closer;

$html = call_pf_script("markdown_to_html.pf", ["markdown" => $value]);
return $style.$html;

Basically this script will get the item provided in the “id” url paramter, find the calculation field value of the table (in markdown format), and convert it to html for proper rendering.

The result is something like this:

Now we just add a new calculation field to the app to show the link to the PF widget:

The code is:

"[Table Link](https://procfu.com/widgets/html/XXXXXXXX?id="+@Unique ID+")"

Even though we’ve added a click, our mobile experience is now much better:

And when clicking on the “Table Link” link, the browser opens:

Part 2 - SuperMenu Magic

Although this makes for a much better mobile experience, the desktop experience has suffered a little bit because we’ve added a click, and the table is not visible by default.

We can fix that with a little SuperMenu magic, to let SuperMenu inject some styles to show the table and hide the link. We can do that with a new always-hidden calculation field like this:

The code is:

// @Title
'[supermenu][style] #calculation { display: block !important; } #calculation-2 { display: none !important; }[/style][/supermenu]'

Note here that calculation is the external_id of the calc field with the table, and calculation-2 is the external_id of the calc field with the link.

The result is the inject of this style line, which you could also do with Stylish or TamperMonkey:

<style>#calculation { display: block !important; } #calculation-2 { display: none !important; }</style>

Now our mobile experience is still nice because the table is hidden by default, but our desktop experience is un-hindered because the table is shown once again:

(c) 2022 Globi Web Solutions | Join the Discussion in our Podio Workspace.