File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -309,6 +309,9 @@ async function getList() {
309
309
310
310
onMounted ( async () => {
311
311
loading .value = true ;
312
+ if (props .meta ? .defaultSort && sort .value .length === 0 ) {
313
+ sort .value = [props .meta .defaultSort ];
314
+ }
312
315
const foreighResourceId = props .meta .foreignResourceId ;
313
316
listResource .value = (await callAdminForthApi ({
314
317
path: ` /plugin/${ props .meta .pluginInstanceId } /get_resource` ,
Original file line number Diff line number Diff line change @@ -111,7 +111,12 @@ export default class ForeignInlineListPlugin extends AdminForthPlugin {
111
111
const similar = suggestIfTypo ( adminforth . config . resources . map ( ( res ) => res . resourceId ) , this . options . foreignResourceId ) ;
112
112
throw new Error ( `ForeignInlineListPlugin: Resource with ID "${ this . options . foreignResourceId } " not found. ${ similar ? `Did you mean "${ similar } "?` : '' } ` ) ;
113
113
}
114
+
115
+ if ( this . options . modifyTableResourceConfig ) {
116
+ this . options . modifyTableResourceConfig ( this . foreignResource ) ;
117
+ }
114
118
119
+ const defaultSort = this . foreignResource . options ?. defaultSort ;
115
120
const newColumn = {
116
121
name : `foreignInlineList_${ this . foreignResource . resourceId } ` ,
117
122
label : 'Foreign Inline List' ,
@@ -128,7 +133,16 @@ export default class ForeignInlineListPlugin extends AdminForthPlugin {
128
133
file : this . componentPath ( 'InlineList.vue' ) ,
129
134
meta : {
130
135
...this . options ,
131
- pluginInstanceId : this . pluginInstanceId
136
+ pluginInstanceId : this . pluginInstanceId ,
137
+ ...( defaultSort
138
+ ? {
139
+ defaultSort : {
140
+ field : defaultSort . columnName ,
141
+ direction : defaultSort . direction ,
142
+ }
143
+ }
144
+ : { }
145
+ )
132
146
}
133
147
}
134
148
} ,
You can’t perform that action at this time.
0 commit comments