Skip to content

Commit 37a8978

Browse files
committed
fix: fix filters when "disableForeignListResourceRefColumn" is active
1 parent b461d6f commit 37a8978

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

custom/InlineList.vue

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@
7373
:to="{
7474
name: 'resource-create',
7575
params: { resourceId: listResource.resourceId },
76-
query: {
76+
query: meta.disableForeignListResourceRefColumn ? {
77+
returnTo: $route.fullPath,
78+
} : {
7779
values: btoa_function(JSON.stringify({[listResourceRefColumn.name]: props.record[selfPrimaryKeyColumn.name]})),
7880
readonlyColumns: btoa_function(JSON.stringify([listResourceRefColumn.name])),
7981
returnTo: $route.fullPath,
@@ -156,7 +158,7 @@ const columnsMinMax = ref(null);
156158
const defaultFilters = ref([]);
157159
158160
const listResourceRefColumn = computed(() => {
159-
if (!listResource.value) {
161+
if (!listResource.value || props.meta.disableForeignListResourceRefColumn) {
160162
return null;
161163
}
162164
return listResource.value.columns.find(c => c.foreignResource?.polymorphicResources
@@ -169,10 +171,14 @@ const selfPrimaryKeyColumn = computed(() => {
169171
});
170172
171173
const filterableColumns = computed(() => {
172-
if (!listResource.value || !listResourceRefColumn.value) {
174+
if (!listResource.value) {
173175
return [];
174176
}
175177
178+
if (props.meta.disableForeignListResourceRefColumn) {
179+
return listResource.value.columns.filter((c) => c.showIn.filter === true);
180+
}
181+
176182
const refColumn = listResourceRefColumn.value;
177183
return listResource.value.columns.filter((c) => c.name !== refColumn.name
178184
&& (refColumn.foreignResource.polymorphicOn ? c.name !== refColumn.foreignResource.polymorphicOn : true));
@@ -310,12 +316,9 @@ async function getList() {
310316
totalRows.value = 0;
311317
return;
312318
}
313-
console.log('data', data.data);
314319
315320
rows.value = data.data?.map(row => {
316-
console.log('row', row);
317321
row._primaryKeyValue = row[listResource.value.columns.find(c => c.primaryKey).name];
318-
console.log('row after pk', row);
319322
return row;
320323
});
321324
totalRows.value = data.total;

0 commit comments

Comments
 (0)