Skip to content

using custom_actions in table component #1079

@DavidLingier

Description

@DavidLingier

Introduction

Using the example from the website https://sql-page.com/component.sql?component=table

To Reproduce

I created a new page and pasted the script below to see the result of this example on my environment.

select 
    'table' as component,
    '/examples/show_variables.sql?action=edit&update_id={id}' as edit_url,
    '/examples/show_variables.sql?action=delete&delete_id={id}' as delete_url,
    JSON('{"name":"history","tooltip":"View Standard History","link":"/examples/show_variables.sql?action=history&standard_id={id}","icon":"history"}') as custom_actions;
select 
    'CalStd'     as name,
    'PharmaCo'   as vendor,
    'P1234'      as Product,
    'T23523'     as "lot number",
    'Available'  as status,
    '2026-10-13' as "expires on",
    32           as _sqlpage_id,
    JSON('{"name":"View PDF","tooltip":"View Presentation","link":"https://sql-page.com/pgconf/2024-sqlpage-badass.pdf","icon":"file-type-pdf"}') as _sqlpage_actions,
    JSON('{"name":"Action","tooltip":"Set In Use","link":"/examples/show_variables.sql?action=set_in_use&standard_id=32","icon":"caret-right"}') as _sqlpage_actions;
select 
    'CalStd'     as name,
    'PharmaCo'   as vendor,
    'P1234'      as Product,
    'T2352'      as "lot number",
    'In Use'     as status,
    '2026-10-14' as "expires on",
    33           as _sqlpage_id,
    JSON('{"name":"View PDF","tooltip":"View Presentation","link":"https://sql-page.com/pgconf/2024-sqlpage-badass.pdf","icon":"file-type-pdf"}') as _sqlpage_actions,
    JSON('{"name":"Action","tooltip":"Retire Standard","link":"/examples/show_variables.sql?action=retire&standard_id=33","icon":"test-pipe-off"}') as _sqlpage_actions;
select 
    'CalStd'                  as name,
    'PharmaCo'                as vendor,
    'P1234'                   as Product,
    'A123'                    as "lot number",
    'Discarded'               as status,
    '2026-09-30'              as "expires on",
    31                        as _sqlpage_id,
    JSON('{"name":"View PDF","tooltip":"View Presentation","link":"https://sql-page.com/pgconf/2024-sqlpage-badass.pdf","icon":"file-type-pdf"}') as _sqlpage_actions,
    JSON('{"name":"Action"}') as _sqlpage_actions;

Actual behavior

After following these steps, what happened ?
If you saw an error on the command line or inside your page, then paste it here

There is no column "history" rendered in the html page:

<html>
<body>
<!--StartFragment-->
<th class="_col_delete text-center">Delete</th>
<th class="_col_custom text-center"></th>
<th class="_col_custom text-center"></th>
<th class="_col_custom text-center"></th>
<th class="_col_custom text-center"></th>
<th class="_col_action text-center">View PDF</th>
<th class="_col_action text-center">Action</th>
</tr>

<!--EndFragment-->
</body>
</html>
There was no error.

Screenshots

Image

Expected behavior

A visible and functional column as shown in the example on the website.

Version information

  • OS: Windows
  • Database [Postgres]
  • SQLPage Version [V0.39.0]:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions