mirror of
https://github.com/strapi/strapi.git
synced 2025-09-22 14:59:07 +00:00
commit
32d68f26d2
@ -9,14 +9,16 @@ const Header = ({ fieldSchema: { type }, metadatas: { label, sortable, mainField
|
||||
const [sortBy, sortOrder] = _sort.split(':');
|
||||
|
||||
let sortField = name;
|
||||
let useRelation = false;
|
||||
|
||||
if (type === 'relation') {
|
||||
useRelation = true;
|
||||
sortField = `${name}.${mainField.name}`;
|
||||
}
|
||||
|
||||
const handleClick = () => {
|
||||
if (sortable) {
|
||||
emitEvent('didSortEntries');
|
||||
emitEvent('didSortEntries', { useRelation });
|
||||
|
||||
const isCurrentSort = sortField === sortBy;
|
||||
const nextOrder = isCurrentSort && sortOrder === 'ASC' ? 'DESC' : 'ASC';
|
||||
|
@ -165,8 +165,9 @@ function FilterPicker({
|
||||
e => {
|
||||
e.preventDefault();
|
||||
const nextFilters = formatFiltersToQuery(modifiedData, metadatas);
|
||||
const useRelation = nextFilters._where.some(obj => Object.keys(obj)[0].includes('.'));
|
||||
|
||||
emitEventRef.current('didFilterEntries');
|
||||
emitEventRef.current('didFilterEntries', { useRelation });
|
||||
setQuery(nextFilters);
|
||||
toggleFilterPickerState();
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user