Skip to content

Conversation

Phoenix79-spec
Copy link

@Phoenix79-spec Phoenix79-spec commented Oct 15, 2025

This pull request adds comprehensive support for action buttons in the table component, allowing users to easily add edit, delete, and custom action buttons at both the table and row level. The documentation and template have been updated to explain and render these new features, making it much easier to include buttons in table data.

Example of table with action buttons.
image

Table action button support

  • Added support for edit_url and delete_url properties to the table component, enabling automatic rendering of Edit and Delete buttons for each row. These URLs can include a {id} placeholder that is replaced by the row's _sqlpage_id. [2]
  • Introduced the custom_actions property at the table level and _sqlpage_actions at the row level, allowing for flexible, user-defined action buttons with custom icons, tooltips, and links. [2]

Limitations

  • The number of action buttons returned by _sqlpage_actions must be the same for all possible rows otherwise buttons might not appear.
  • Users can overcome this limitation by including placeholder objects over blank spaces

Example placeholder

{
  "name": "action"
}

Example custom_action

{
    "name": "history",
    "tooltip": "View Standard History",
    "link": "./history.sql?standard_id={id}",
    "icon": "history"
}

Documentation and examples

  • Expanded documentation in 01_documentation.sql with detailed explanations and a full example of using edit_url, delete_url, custom_actions, and _sqlpage_actions in tables. [1]

Template changes

  • Updated table.handlebars to render Edit, Delete, and custom action buttons in both the table header and body, including dynamic tooltips and icons. [2]
  • Added id="{{component_index}}-search" to the search input for improved accessibility and easier DOM manipulation. [2]

* A default edit and delete button can be included by specifying an "edit_url" or "delete_url"
* Custom Column based action buttons can be added in the table header using json object array in the custom_actions column.
* Custom action buttons can be defined on the row level by specifying _sqlpage_actions.
… centered, and _col_{name} is included in new rows.
 cargo clippy
    Checking sqlpage v0.38.0
error: redundant else block
   --> src\webserver\http.rs:493:6
    |
493 |       } else {
    |  ______^
494 | |         if let Some(domain) = &config.https_domain {
495 | |             let mut listen_on_https = listen_on;
496 | |             listen_on_https.set_port(443);
...   |
511 | |     }
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_else
note: the lint level is defined here
   --> src\lib.rs:1:9
    |
  1 | #![deny(clippy::pedantic)]
    |         ^^^^^^^^^^^^^^^^
    = note: `#[deny(clippy::redundant_else)]` implied by `#[deny(clippy::pedantic)]`
help: remove the `else` block and move the contents out
    |
493 ~     }
494 +     if let Some(domain) = &config.https_domain {
495 +         let mut listen_on_https = listen_on;
496 +         listen_on_https.set_port(443);
497 +         log::debug!("Will start HTTPS server on {listen_on_https}");
498 +         let config = make_auto_rustls_config(domain, config);
499 +         server = server
500 +             .bind_rustls_0_23(listen_on_https, config)
501 +             .map_err(|e| bind_error(e, listen_on_https))?;
502 +     } else if listen_on.port() == 443 {
503 +         bail!("Please specify a value for https_domain in the configuration file. This is required when using HTTPS (port 443)");
504 +     }
505 +     if listen_on.port() != 443 {
506 +         log::debug!("Will start HTTP server on {listen_on}");
507 +         server = server
508 +             .bind(listen_on)
509 +             .map_err(|e| bind_error(e, listen_on))?;
510 +     }
    |

error: could not compile `sqlpage` (lib) due to 1 previous error
@Phoenix79-spec Phoenix79-spec marked this pull request as ready for review October 20, 2025 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant