Download a file
Last updated
Was this helpful?
Was this helpful?
title: Download Invoice
description: Download a specific invoice
type: jig.list
header:
type: component.jig-header
options:
height: medium
children:
type: component.image
options:
source:
uri: https://builder.jigx.com/assets/images/header.jpg
onFocus:
type: action.sync-entities
options:
# reference the OneDrive provider to sync the files metadata to the app
# local provider.
provider: DATA_PROVIDER_ONEDRIVE
entities:
- entity: myfiles
data:
# reference the required OneDrive tokenType property.
tokenType: jigx.graph.oauth
datasources:
file-data-root:
type: datasource.sqlite
options:
# use the local data provider to store the OneDrive files metadata.
provider: DATA_PROVIDER_LOCAL
# specify the OneDrive path to the files.
entities:
- myfiles
# use a query to define what metadata must be returned to the jig.
query: SELECT id, '$.name' as name FROM [myfiles] ORDER BY name DESC
data: =@ctx.datasources.file-data-root
item:
type: component.list-item
options:
title: =@ctx.current.item.name
rightElement:
element: button
title: Download
onPress:
# go to a default jig to use the submit-form action.
# to download the selected file.
type: action.go-to
options:
linkTo: download-file
# In the inputs use the OneDrive required properties.
# of the selected file from the list to pass to the default jig.
inputs:
fileName: =@ctx.current.item.name
id: =@ctx.current.item.id
entity: myfilestitle: Download File
description: 1 download
type: jig.default
header:
type: component.jig-header
options:
children:
options:
source:
uri: https://builder.jigx.com/assets/images/header.jpg
type: component.image
height: medium
children:
- type: component.form
instanceId: fileDownload
options:
children:
- type: component.text-field
instanceId: fileName
options:
label: File Name
initialValue: =@ctx.jig.inputs.fileName
- type: component.text-field
instanceId: id
options:
initialValue: =@ctx.jig.inputs.id
isHidden: true
label: id
actions:
- children:
- type: action.submit-form
options:
provider: DATA_PROVIDER_ONEDRIVE
entity: myfiles
data:
fileName: =@ctx.components.fileName.state.value
tokenType: jigx.graph.oauth
id: =@ctx.components.id.state.value
title: Download
formId: fileDownload
goBack: previous
method: download