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