fix: association collection field should not support sortable (#4288)

* fix: association collection  field should not support sortable

* fix: association collection  field should not support sortable
This commit is contained in:
katherinehhh 2024-05-09 11:44:20 +08:00 committed by GitHub
parent 7fc8af7e7b
commit c9c14df4f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -19,6 +19,7 @@ import { useColumnSchema } from '../../../../schema-component/antd/table-v2/Tabl
import { SchemaSettingsDefaultValue } from '../../../../schema-settings/SchemaSettingsDefaultValue';
import { useFieldComponentName } from './utils';
import { isPatternDisabled } from '../../../../schema-settings/isPatternDisabled';
import { useCollection } from '../../../../data-source';
export const tableColumnSettings = new SchemaSettings({
name: 'fieldSettings:TableColumn',
@ -122,12 +123,15 @@ export const tableColumnSettings = new SchemaSettings({
name: 'sortable',
type: 'switch',
useVisible() {
const collection = useCollection();
const { collectionField } = useColumnSchema();
const { getInterface } = useCollectionManager_deprecated();
const interfaceCfg = getInterface(collectionField?.interface);
const { currentMode } = useAssociationFieldContext();
return interfaceCfg?.sortable === true && !currentMode;
return (
interfaceCfg?.sortable === true && !currentMode && collection?.name === collectionField?.collectionName
);
},
useComponentProps() {
const field: any = useField();