Skip to content

Commit 490711a

Browse files
committed
add "searchable" as an alias for dropdown in the form component
thanks @c-classen sqlpage#297
1 parent 200cce3 commit 490711a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

examples/official-site/sqlpage/migrations/01_documentation.sql

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,8 @@ INSERT INTO parameter(component, name, description, type, top_level, optional) S
225225
('max', 'The minimum value to accept for an input of type number', 'NUMBER', FALSE, TRUE),
226226
('checked', 'Used only for checkboxes and radio buttons. Indicates whether the checkbox should appear as already checked.', 'BOOL', FALSE, TRUE),
227227
('multiple', 'Used only for select elements. Indicates that multiple elements can be selected simultaneously. When using multiple, you should add square brackets after the variable name: ''my_variable[]'' as name', 'BOOL', FALSE, TRUE),
228-
('dropdown', 'For select and multiple-select elements, displays them with a nice dropdown that allows searching for options.', 'BOOL', FALSE, TRUE),
228+
('searchable', 'For select and multiple-select elements, displays them with a nice dropdown that allows searching for options.', 'BOOL', FALSE, TRUE),
229+
('dropdown', 'An alias for "searchable".', 'BOOL', FALSE, TRUE),
229230
('create_new', 'In a multiselect with a dropdown, this option allows the user to enter new values, that are not in the list of options.', 'BOOL', FALSE, TRUE),
230231
('step', 'The increment of values in an input of type number. Set to 1 to allow only integers.', 'NUMBER', FALSE, TRUE),
231232
('description', 'A helper text to display near the input field.', 'TEXT', FALSE, TRUE),
@@ -300,7 +301,7 @@ SELECT
300301
FROM fruits
301302
```
302303
', json('[{"component":"form", "action":"examples/show_variables.sql"},
303-
{"name": "Fruit", "type": "select", "dropdown": true, "value": 1, "options":
304+
{"name": "Fruit", "type": "select", "searchable": true, "value": 1, "options":
304305
"[{\"label\": \"Orange\", \"value\": 0}, {\"label\": \"Apple\", \"value\": 1}, {\"label\": \"Banana\", \"value\": 3}]"}
305306
]')),
306307
('form', '### Multi-select
@@ -338,7 +339,7 @@ left join my_user_options
338339
and my_user_options.user_id = $user_id
339340
```
340341
', json('[{"component":"form", "action":"examples/show_variables.sql"},
341-
{"label": "Fruits", "name": "fruits[]", "type": "select", "multiple": true, "create_new":true, "placeholder": "Good fruits...", "dropdown": true, "description": "press ctrl to select multiple values", "options":
342+
{"label": "Fruits", "name": "fruits[]", "type": "select", "multiple": true, "create_new":true, "placeholder": "Good fruits...", "searchable": true, "description": "press ctrl to select multiple values", "options":
342343
"[{\"label\": \"Orange\", \"value\": 0, \"selected\": true}, {\"label\": \"Apple\", \"value\": 1}, {\"label\": \"Banana\", \"value\": 3, \"selected\": true}]"}
343344
]')),
344345
('form', 'This example illustrates the use of the `radio` type.

sqlpage/templates/form.handlebars

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
{{~#if required}} required="required" {{/if~}}
6464
{{~#if autofocus}} autofocus {{/if~}}
6565
{{~#if multiple}} multiple {{/if~}}
66-
{{~#if dropdown}}
66+
{{~#if (or dropdown searchable)}}
6767
data-pre-init="select-dropdown"
6868
data-sqlpage-js="/{{static_path 'tomselect.js'}}"
6969
{{/if~}}

0 commit comments

Comments
 (0)