This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

nanohard
nanohard

I just noticed that my pivot data isn't sortable in the backend view. Does anyone know of a way to make pivot data sortable in the same way that other data is sortable (ascending and descending)?

pivot columns.yaml:

columns:
name:
    label: Submenu
    searchable: true

pivot[order_num]:
    label: Order

config_relation.yaml

submenus:
label: Submenus
view:
    list: $/posignite/menu/models/menusubmenuspivot/columns.yaml
    toolbarButtons: add|remove
    showSorting: true
manage:
    showSearch: true
    recordsPerPage: 10
    list: $/posignite/menu/models/submenu/columns.yaml
pivot:
    form: $/posignite/menu/models/menusubmenuspivot/fields.yaml

Last updated

nanohard
nanohard

In order to make the pivot column sortable I had to add a column that uses 'select'. Here is the updated pivot model's columns.yaml that works:

columns:
order_num:
    label: Order
    select: posignite_menu_menu_submenus.order_num
    sortable: true
    width: 10em

# In order to be sortable, a non-pivot entry is needed; make this invisible (not sure if actually needed).
pivot[order_num]:
    label: Order
    width: 10em
    invisible: true

name:
    label: Submenu
    searchable: true
    sortable: true

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.