Advanced expressions
Examples and code snippets
Create a filtered list from an array of records

title: List with advanced Expressions
type: jig.list
datasources:
people:
type: datasource.static
options:
data:
- id: 1
firstname: Mark
lastname: Dobrew
email: mark@gmail.com
mobile: 783432565
registered: false
- id: 2
firstname: Astra
lastname: Courts
email: astra@gmail.com
mobile: 437874221
registered: false
- id: 3
firstname: Jane
lastname: Doe
email: jane@gmail.com
mobile: 783432531
registered: true
- id: 4
firstname: ''
lastname: ''
email: steve@gmail.com
mobile: 783432531
registered: true
data: =@ctx.datasources.people[firstname != '' and lastname != '']
item:
type: component.list-item
options:
title: "=@ctx.current.item.firstname
& ' ' &
@ctx.current.item.lastname"
subtitle: ='Phone:' & @ctx.current.item.mobile
description: ='Email:' & @ctx.current.item.email
style:
isHighlighted: "=@ctx.current.item.registered = true
? true:false"
label:
title: "=@ctx.current.item.registered = true
? 'Registered':'Not registered'"
color:
- when: =@ctx.current.item.registered = true
color: color2
- when: =@ctx.current.item.registered = false
color: color4
leftElement:
type: avatar
text: "=$substring(@ctx.current.item.firstname,0,1)
& $substring(@ctx.current.item.lastname,0,1)"Define functions to run the expressions

Last updated
Was this helpful?