File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed
src/components/DsfrDataTable Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -104,19 +104,20 @@ const sortedRows = computed(() => {
104104 }
105105 return _sortedRows
106106})
107- const finalRows = computed (() => {
108- const rowKeys = props . headersRow . map (( header ) => {
109- if ( typeof header !== ' object ' ) {
110- return header
111- }
112- return header . key
113- } )
107+ const rowKeys = computed (() => props . headersRow . map (( header ) => {
108+ if ( typeof header !== ' object ' ) {
109+ return header
110+ }
111+ return header . key
112+ }))
113+ const rowKeyIndex = computed (() => rowKeys . value . findIndex ( key => key === props . rowKey ) )
114114
115+ const finalRows = computed (() => {
115116 const rows = sortedRows .value .map ((row ) => {
116117 if (Array .isArray (row )) {
117118 return row
118119 }
119- return rowKeys .map (key => typeof row !== ' object' ? row : row [key ] ?? row )
120+ return rowKeys .value . map (key => typeof row !== ' object' ? row : row [key ] ?? row )
120121 })
121122
122123 if (props .pagination ) {
@@ -225,11 +226,10 @@ function copyToClipboard (text: string) {
225226 role =" columnheader"
226227 >
227228 <div class =" fr-checkbox-group fr-checkbox-group--sm" >
228- <!-- @vue-expect-error TS2538 -->
229229 <input
230230 :id =" `row-select-${id}-${idx}`"
231231 v-model =" selection"
232- :value =" rows[idx][rowKey ] ?? `row-${idx}`"
232+ :value =" row[rowKeyIndex ] ?? `row-${idx}`"
233233 type =" checkbox"
234234 >
235235 <label
You can’t perform that action at this time.
0 commit comments