Ungrid filters reference

This is a reference of all the available custom filters in Ungrid. For Liquid standard filters, see Liquid basics in the Shopify docs.

align

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

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

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

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

if

resolves to the value of the parameter if the incoming value is truthy. Combine with default to set a default value if the condition is not met.

assign badge_color = product.analytics.num_orders_7d > 0 | if: "success" | default: "neutral"

format

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

finds a column in view.columns by its handle

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

group_by

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

assign a referencable handle to a column. This can be used to reference the column in the code (via find, position_after, position_before, etc.). A column will otherwise always have a default handle created from its title.

assign my_col = column | handle: "my_column"

limit

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

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

positions a column after another column via its handle

assign my_col = column | position_after: 'tags'

position_before

positions a column before another column via its handle

assign my_col = column | position_before: 'tags'

rows

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

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

assign my_col = column | searchable

sort_by

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

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

assign my_col = column | sortable

sticky

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

assign my_col = column | sticky

title

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

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

assign view = view | use_stripes

use_borders

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

assign view = view | use_borders

value

sets a column's value for each row

assign my_col = column | value: product.tags

when

case/switch like filter. If the incoming value matches the first parameter, it resolves to the value of second parameter. Multiple parameter sets are allowed. Combine with default to set a default value if no conditions are met.

assign badge_color = product.status | when: "active", "success", "unlisted", "info" | default: "neutral"