Custom add-on with a table in EE6. Trying to get the thing to sort by ID descending (so starting with the newest items), but just can’t figure it out.
$table = ee('CP/Table', [
'autosearch' => true,
'sort_col' => 'addon_widget_id'
'sort_dir' => 'desc'
])
The sort_dir param is not being caught. It keeps sorting ascending.
Works for some reason this way:
$sort_col = ee()->input->get('sort_col') ? ee()->input->get('sort_col') : 'addon_widget_id';
$sort_dir = ee()->input->get('sort_dir') ? ee()->input->get('sort_dir') : 'desc';
$table = ee('CP/Table', [
'sort_col' => $sort_col,
'sort_dir' => $sort_dir
]);
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.