fix(fe): auto fit grid column widths to 100% parent container width
This commit is contained in:
@@ -22,6 +22,9 @@ const rowSelectionOptions = computed(() => props.rowSelection === 'none' ? undef
|
|||||||
function onRowClicked(event: RowClickedEvent): void {
|
function onRowClicked(event: RowClickedEvent): void {
|
||||||
if (event.data) emit('rowSelected', event.data)
|
if (event.data) emit('rowSelected', event.data)
|
||||||
}
|
}
|
||||||
|
function onGridReady(params: { api: { sizeColumnsToFit: () => void } }): void {
|
||||||
|
params.api.sizeColumnsToFit()
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="ks-grid" :aria-busy="props.loading">
|
<div class="ks-grid" :aria-busy="props.loading">
|
||||||
@@ -32,7 +35,10 @@ function onRowClicked(event: RowClickedEvent): void {
|
|||||||
:column-defs="columnDefs"
|
:column-defs="columnDefs"
|
||||||
:row-selection="rowSelectionOptions"
|
:row-selection="rowSelectionOptions"
|
||||||
:loading="props.loading"
|
:loading="props.loading"
|
||||||
|
:auto-size-strategy="{ type: 'fitGridWidth' }"
|
||||||
:suppress-no-rows-overlay="props.rows.length > 0"
|
:suppress-no-rows-overlay="props.rows.length > 0"
|
||||||
|
@grid-ready="onGridReady"
|
||||||
|
@first-data-rendered="onGridReady"
|
||||||
@row-clicked="onRowClicked"
|
@row-clicked="onRowClicked"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user