@@ -47,12 +47,14 @@ function DataResult({ data, isLoading }: DataResultProps) {
4747 } ;
4848
4949 // Data columns
50+ const isSingleColumn = data . header . length === 1 ;
51+
5052 const dataColumns : ColumnDef < string [ ] > [ ] = data . header . map (
5153 ( header , index ) => ( {
5254 id : `col_${ index } ` ,
5355 accessorFn : ( row : string [ ] ) => row [ index ] ,
5456 header : header ,
55- size : DEFAULT_COLUMN_WIDTH ,
57+ size : isSingleColumn ? 9999 : DEFAULT_COLUMN_WIDTH ,
5658 minSize : 50 ,
5759 } )
5860 ) ;
@@ -165,6 +167,7 @@ function DataResult({ data, isLoading }: DataResultProps) {
165167 const totalSize = virtualizer . getTotalSize ( ) ;
166168 const { rows : tableRows } = table . getRowModel ( ) ;
167169 const tableWidth = table . getTotalSize ( ) ;
170+ const isSingleColumn = data . header . length === 1 ;
168171
169172 return (
170173 < div className = "w-full" >
@@ -192,7 +195,11 @@ function DataResult({ data, isLoading }: DataResultProps) {
192195 ? "text-center sticky left-0 bg-default-100 z-30"
193196 : "text-left"
194197 } `}
195- style = { { width : header . getSize ( ) } }
198+ style = {
199+ isSingleColumn && header . id !== "_index"
200+ ? { flex : 1 }
201+ : { width : header . getSize ( ) }
202+ }
196203 >
197204 { flexRender (
198205 header . column . columnDef . header ,
@@ -249,7 +256,11 @@ function DataResult({ data, isLoading }: DataResultProps) {
249256 } `
250257 : "text-left"
251258 } `}
252- style = { { width : cell . column . getSize ( ) } }
259+ style = {
260+ isSingleColumn && cell . column . id !== "_index"
261+ ? { flex : 1 }
262+ : { width : cell . column . getSize ( ) }
263+ }
253264 >
254265 { flexRender (
255266 cell . column . columnDef . cell ,
0 commit comments