This repository was archived by the owner on Mar 27, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +8
-15
lines changed
packages/bootstrap-vue-next/src/components/BTable Expand file tree Collapse file tree 2 files changed +8
-15
lines changed Original file line number Diff line number Diff line change @@ -338,10 +338,11 @@ const noProviderFilteringBoolean = useBooleanish(() => props.noProviderFiltering
338
338
339
339
const isFilterableTable = computed (() => props .filter !== undefined && props .filter !== ' ' )
340
340
341
- const isSortable = computed (
342
- () =>
341
+ const isSortable = computed (() => {
342
+ const hasSortableFields =
343
343
props .fields .filter ((field ) => (typeof field === ' string' ? false : field .sortable )).length > 0
344
- )
344
+ return hasSortableFields || props .sortBy !== undefined
345
+ })
345
346
const usesProvider = computed (() => props .provider !== undefined )
346
347
347
348
const selectedItems = ref <Set <TableItem >>(new Set ([]))
@@ -383,6 +384,8 @@ const addSelectableCell = computed(
383
384
() => selectableBoolean .value && (!! props .selectHead || slots .selectHead !== undefined )
384
385
)
385
386
387
+ const requireItemsMapping = computed (() => isSortable .value && sortInternalBoolean .value === true )
388
+
386
389
const {
387
390
computedItems,
388
391
computedDisplayItems,
@@ -396,6 +399,7 @@ const {
396
399
isFilterableTable ,
397
400
noProviderPagingBoolean ,
398
401
isSortable ,
402
+ requireItemsMapping ,
399
403
sortDescBoolean ,
400
404
},
401
405
usesProvider .value
Original file line number Diff line number Diff line change @@ -28,21 +28,10 @@ export const useTableItems = (
28
28
const filteredHandler = ref < ( items : TableItem [ ] ) => void > ( )
29
29
const internalItems = ref ( tableProps . items ?? [ ] )
30
30
const displayStartEndIdx = ref ( [ 0 , internalItems . value . length ] )
31
- const requireItemsMapping = computed (
32
- ( ) => isSortable . value && flags . sortInternalBoolean . value === true
33
- )
34
-
35
- const isSortable = computed ( ( ) => {
36
- const sortableLength = tableProps . fields ?. filter ( ( field ) =>
37
- typeof field === 'string' ? false : field . sortable
38
- ) ?. length
39
- return sortableLength && sortableLength > 0
40
- } )
41
-
42
31
const computedItems = computed < TableItem [ ] > ( ( ) => {
43
32
const items = usesProvider
44
33
? internalItems . value
45
- : requireItemsMapping . value
34
+ : flags . requireItemsMapping . value
46
35
? mapItems ( internalItems , tableProps , flags )
47
36
: tableProps . items ?? [ ]
48
37
You can’t perform that action at this time.
0 commit comments