Ungrid filters reference

align

  • Name
    align
    Description

    Set a column's horizonal alignment to left (default) or right. This will align both the column's header and the column's content

assign my_column = column | align: "right"

attention

  • Name
    attention
    Description

    Set a view attention flag and optionally a text. First parameter is an attention level of neutral, info, success, caution, warning or critical, and the second parameter an optional message. The attention flag and message will be shown in the tab for the view, regardless of whether the view is currently visible or not.

assign view = view | attention: "caution", "Low stock"

columns

  • Name
    columns
    Description

    Assign columns to a view. The columns (by handle) can be both existing and new columns.

assign view = view | columns: column1, column2, column3, ...

format

  • Name
    format
    Description

    formats a column's values according to the specified format.

    Supported formats are badge, media, date, date_from_now, stars and trend.

    • badge, stars takes an optional second parameter for its color: one of success, info, warning or critical

    • date takes an optional second parameter for its format: see https://strftime.net/ for options

    • date_from_now returns a relative expression compared to the current time, e.g. "2 hours ago" or "in 4 days" (add "strict" as a second parameter to get a more strict relative expression)

    • trend returns a trend indicator for a column, e.g. "up" or "down" for positive or negative values

assign my_col = column | format: "date", "%d %b, %Y"
assign my_col = column | format: "badge", "success"

find

  • Name
    find
    Description

    finds a column in view.columns by its handle

assign my_col = view.columns | find: "vendor"

group_by

  • Name
    group_by
    Description

    groups the view's rows by the value of the specified column or column handle.

    Use parameters column, asc or column, desc to sort the group in the preferred order

assign view = view | group_by: "vendor", "asc"

handle

  • Name
    handle
    Description

    assign a referencable handle to a column. This can be used to reference the column in the code. A column will otherwise always have a handle created from its title.

assign my_col = column | handle: "my_column"

limit

  • Name
    limit
    Description

    set a column to limit the number of items in an array to the specified size

assign my_col = column | value: product.tags | limit: 3

page_size

  • Name
    page_size
    Description

    sets the number of rows shown per page. You cannot set a page size greater than 50

assign view = view | page_size: 30

position_after

  • Name
    position_after
    Description

    positions a column after another column via its handle

assign my_col = column | position_after: 'tags'

position_before

  • Name
    position_before
    Description

    positions a column before another column via its handle

assign my_col = column | position_before: 'tags'

rows

  • Name
    rows
    Description

    defines the rows to be displayed in the view. You can omit this filter to display all rows for the view type or assign a variable to filter your items according to your needs

assign rows_with_out_of_stock_tags = products | where_exp: "p", "p.tags contains 'out-of-stock'"
assign view = view | rows: rows_with_out_of_stock_tags

searchable

  • Name
    searchable
    Description

    marks a column as searchable, so the rows may be filtered by the column's values

assign my_col = column | searchable

sort_by

  • Name
    sort_by
    Description

    sets a view to be initially sorted (when first loaded) by the specified column or column handle.

    Use parameters column, asc or column, desc to sort by a column in the preferred order

assign view = view | sort_by: "num_orders", "desc"

sortable

  • Name
    sortable
    Description

    marks a column as sortable, so the rows may be sorted by the column's values

assign my_col = column | sortable

sticky

  • Name
    sticky
    Description

    marks a column as sticky, so it won't move when the view is scrolled horizontally

assign my_col = column | sticky

title

  • Name
    title
    Description

    sets a column's title. This will be shown in bold in the column's header

assign my_col = column | title: "My column"

use_stripes

  • Name
    use_stripes
    Description

    sets a view to use alternate background colors for each row in the table

assign view = view | use_stripes

use_borders

  • Name
    use_borders
    Description

    sets a view to use borders around each cell in the table

assign view = view | use_borders

value

  • Name
    value
    Description

    sets a column's value for each row

assign my_col = column | value: product.tags