@@ -453,16 +453,20 @@ const headersForRender = computed((): HeaderForRender[] => {
453453
454454const headerColumns = computed ((): string [] => headersForRender .value .map ((header ) => header .value ));
455455
456- const generateColumnContent = (column : string , item : Item ) => {
457- let content: any = ' ' ;
456+ const getItemValue = (column : string , item : Item ) => {
458457 if (column .includes (' .' )) {
459- const propertyArr = column .split (' .' );
460- propertyArr .forEach ((property , index ) => {
461- content = (index === 0 ? item [property ] : content [property ]);
458+ let content: any = ' ' ;
459+ const keysArr = column .split (' .' );
460+ keysArr .forEach ((key , index ) => {
461+ content = (index === 0 ? item [key ] : content [key ]);
462462 });
463- } else {
464- content = item [column ];
463+ return content ;
465464 }
465+ return item [column ];
466+ };
467+
468+ const generateColumnContent = (column : string , item : Item ) => {
469+ const content = getItemValue (column , item );
466470 return Array .isArray (content ) ? content .join (' ,' ) : content ;
467471};
468472
@@ -597,8 +601,8 @@ const itemsSorting = computed((): Item[] => {
597601 const itemsFilteringSorted = [... itemsFiltering .value ];
598602 // eslint-disable-next-line vue/no-side-effects-in-computed-properties
599603 return itemsFilteringSorted .sort ((a , b ) => {
600- if (a [ sortBy ] < b [ sortBy ] ) return sortDesc ? 1 : - 1 ;
601- if (a [ sortBy ] > b [ sortBy ] ) return sortDesc ? - 1 : 1 ;
604+ if (getItemValue ( sortBy , a ) < getItemValue ( sortBy , b ) ) return sortDesc ? 1 : - 1 ;
605+ if (getItemValue ( sortBy , a ) > getItemValue ( sortBy , b ) ) return sortDesc ? - 1 : 1 ;
602606 return 0 ;
603607 });
604608});
0 commit comments