/
list-filter-search-label-dd.jigx
66 lines (57 loc) · 1.76 KB
/
list-filter-search-label-dd.jigx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
title: Filter & Search List (Dynamic)
description: A dynamic list displaying filter and searching
type: jig.list
icon: notes-paper-approve
isSearchable: true
filter:
- title: All
value: ''
- title: Indoor
value: TRUE
- title: Outdoor
value: FALSE
header:
type: component.jig-header
options:
height: medium
children:
type: component.image
options:
source:
uri: https://images.unsplash.com/photo-1529220502050-f15e570c634e?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1829&q=80
datasources:
cleaning-services-dynamic:
type: datasource.sqlite
options:
provider: DATA_PROVIDER_DYNAMIC
entities:
- entity: default/cleaning-services
query: |
SELECT
id,
'$.area',
'$.description',
'$.hourlyrate',
'$.illustration',
'$.image',
'$.indoor',
'$.onceoffrate',
'$.service',
'$.time'
FROM [default/cleaning-services]
WHERE ('$.indoor' LIKE @filter OR @filter IS NULL) AND ('$.service' LIKE '%'||@search||'%' OR @search IS NULL)
queryParameters:
filter: =@ctx.jig.state.filter
search: =@ctx.jig.state.searchText
data: =@ctx.datasources.cleaning-services-dynamic
item:
type: component.list-item
options:
title: =@ctx.current.item.service
subtitle: =@ctx.current.item.area
label:
title: =(@ctx.current.item.indoor = "TRUE" ? 'Indoor':'Outdoor')
leftElement:
element: avatar
text: =$substring($substringBefore(@ctx.current.item.service, " "), 1, 1) & $substring($substringAfter(@ctx.current.item.service, " ") , 1, 1)
uri: =@ctx.current.item.image