lovasoa / SQLpage

SQL-only webapp builder, empowering data analysts to build websites and applications quickly
https://sql.ophir.dev
MIT License
882 stars 62 forks source link

Shell component: search should retain value #356

Closed E8y2FqZE closed 1 month ago

E8y2FqZE commented 1 month ago

Introduction

When the search_target is provided in the shell component, the ?search= query parameter value should be used as the text input value when present. Currently the search input is cleared on every page load.

Actual behavior

Notice that the search input field is empty when the ?search= query parameter is present.

Screenshots

image

Expected behavior

The search value should be in the text box rather than being blank. This is standard UI behavior (e.g. search for something on Github, when the results are returned the textbox is not cleared out).

lovasoa commented 1 month ago

Hello and welcome to SQLPage, @E8y2FqZE ! Can you tell us more about what you are building ? I'm not sure the framework (SQLPage) should prefill the text field when the search URL parameter is set, but I'm sure it should at least be possible for the application author to easily implement this behavior. We should add a search_value parameter to the shell component.

This can be done here: https://github.com/lovasoa/SQLpage/blob/main/sqlpage/templates/shell.handlebars#L98 and should be documented here: https://github.com/lovasoa/SQLpage/blob/main/examples/official-site/sqlpage/migrations/01_documentation.sql#L748-L767

Can you open a pull request ?

amrutadotorg commented 1 month ago

Hi, see if that works #359 then I can update the doc

E8y2FqZE commented 1 month ago

Here's a non-JS version: #362

lovasoa commented 1 month ago

I'm closing this since we merged #362