Delete a file

Delete a file in a jig

In this example, a list of expenses is displayed with the following:

  • The subtitle displays the filename.

  • A label is configured with color and text to display the status of the file.

  • A left swipeable action is configured with two actions:

    • The first only deletes the file associated with the record using the execute-entity action with the update method and the file property set to null.

    • The second deletes the entire record in the database using the execute-entity action with the delete method.

title: Expense Categories
description: List of Expenses
type: jig.list
icon: bill-cross-money-clipboard

header:
  type: component.jig-header
  options:
    height: medium
    children:
      type: component.image
      options:
        source:
          uri: https://cdn.pixabay.com/photo/2023/08/22/11/57/finance-8206242_1280.jpg

data: [email protected]
item:
  type: component.list-item
  options:
    title: [email protected]
    # Configure the subtitle to display the document filename.
    subtitle: [email protected]
    # Use the label to show the status of the file,
    # as shown in the file metadata. 
    label:
      color:
        - when: [email protected] = 'UPLOADED'
          color: color2
        - when: [email protected] = 'PENDING'
          color: primary
        - when: [email protected] = 'PROCESSING'
          color: color3
      title: [email protected]
    leftElement:
      # Configure a left avatar int he list to display the file thumbnail.
      element: avatar
      text: ""
      uri: |
        [email protected] != null ? 'data:image/png;base64,' & @ctx.current.item.thumbnail :
        @ctx.current.item.localPath != null ? @ctx.current.item.localPath
   # Configure a left swipeable action with two actions, 
   # the first deletes the entire record in the database.
   # The second only deletes the file associated with the record.      
    swipeable:
      left:
        - label: Delete expense
          icon: delete-2
          color: negative
          onPress: 
            # First action deleting entire record.
            type: action.execute-entity
            options:
              provider: DATA_PROVIDER_DYNAMIC
              entity: default/expenses
              method: delete
              goBack: stay
              data:
                id: [email protected]
        - label: Delete receipt
          icon: bin-2-alternate
          color: warning
          onPress: 
            # Second action only deletes the file. 
            # The records still exists. 
            type: action.execute-entity
            options:
              provider: DATA_PROVIDER_DYNAMIC
              entity: default/expenses
              method: update
              goBack: stay
              data:
                id: [email protected]
              file: null
# Action configured to go to the create expense jig, 
# where a file can be uploaded.            
actions:
  - children:
      - type: action.go-to
        options:
          title: Create Expense
          linkTo: files-create-expense 

In Management the Hotel accommodation record is deleted in the expense dynamic data table and the airplane ticket file is deleted but the record still exists.

Delete a file in Jigx Management

Files can be deleted in Management by following these steps:

  1. Browse to the required solution's data tab and select the record containing the file to be deleted.

  2. Select the File tab, and click the x next to file's thumbnail. Caution: Clicking the Delete button at the bottom of the Edit record pane deletes the entire record and file.

Last updated

Was this helpful?