fix(fe): ensure No. column row numbers 1, 2, 3 remain strictly fixed via redrawRows on sort-changed
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 57 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 57 KiB |
@@ -23,7 +23,8 @@ const columnDefs = computed<ColDef[]>(() => {
|
||||
if (props.showRowNumber) {
|
||||
const rowNumCol: ColDef = {
|
||||
headerName: 'No.',
|
||||
valueGetter: params => (params.node?.rowIndex !== null && params.node?.rowIndex !== undefined) ? params.node.rowIndex + 1 : '',
|
||||
valueGetter: 'node.rowIndex + 1',
|
||||
colId: 'rowNum',
|
||||
width: 54,
|
||||
minWidth: 50,
|
||||
maxWidth: 65,
|
||||
@@ -43,6 +44,9 @@ const rowSelectionOptions = computed(() => props.rowSelection === 'none' ? undef
|
||||
function onRowClicked(event: RowClickedEvent): void {
|
||||
if (event.data) emit('rowSelected', event.data)
|
||||
}
|
||||
function onSortChanged(params: { api: { redrawRows: () => void; refreshCells: (options: { force: boolean }) => void } }): void {
|
||||
params.api.redrawRows()
|
||||
}
|
||||
function onGridReady(params: { api: { sizeColumnsToFit: () => void } }): void {
|
||||
params.api.sizeColumnsToFit()
|
||||
}
|
||||
@@ -60,6 +64,7 @@ function onGridReady(params: { api: { sizeColumnsToFit: () => void } }): void {
|
||||
:suppress-no-rows-overlay="props.rows.length > 0"
|
||||
@grid-ready="onGridReady"
|
||||
@first-data-rendered="onGridReady"
|
||||
@sort-changed="onSortChanged"
|
||||
@row-clicked="onRowClicked"
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user