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() {
309309
310310onMounted ( async () => {
311311 loading .value = true ;
312+ if (props .meta ? .defaultSort && sort .value .length === 0 ) {
313+ sort .value = [props .meta .defaultSort ];
314+ }
312315 const foreighResourceId = props .meta .foreignResourceId ;
313316 listResource .value = (await callAdminForthApi ({
314317 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 {
111111 const similar = suggestIfTypo ( adminforth . config . resources . map ( ( res ) => res . resourceId ) , this . options . foreignResourceId ) ;
112112 throw new Error ( `ForeignInlineListPlugin: Resource with ID "${ this . options . foreignResourceId } " not found. ${ similar ? `Did you mean "${ similar } "?` : '' } ` ) ;
113113 }
114+
115+ if ( this . options . modifyTableResourceConfig ) {
116+ this . options . modifyTableResourceConfig ( this . foreignResource ) ;
117+ }
114118
119+ const defaultSort = this . foreignResource . options ?. defaultSort ;
115120 const newColumn = {
116121 name : `foreignInlineList_${ this . foreignResource . resourceId } ` ,
117122 label : 'Foreign Inline List' ,
@@ -128,7 +133,16 @@ export default class ForeignInlineListPlugin extends AdminForthPlugin {
128133 file : this . componentPath ( 'InlineList.vue' ) ,
129134 meta : {
130135 ...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+ )
132146 }
133147 }
134148 } ,
You can’t perform that action at this time.
0 commit comments