mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Tempo: Fix sorting for nested tables (#87214)
This commit is contained in:
parent
57038e8dfa
commit
f99d4ee92d
@ -254,7 +254,9 @@ export const RowsList = (props: RowsListProps) => {
|
||||
<ExpandedRow
|
||||
nestedData={nestedDataField}
|
||||
tableStyles={tableStyles}
|
||||
rowIndex={index}
|
||||
// Using `row.index` ensures that we pick the correct row from the original data frame even when rows in
|
||||
// the table are sorted, since `row.index` does not change when sorting.
|
||||
rowIndex={row.index}
|
||||
width={width}
|
||||
cellHeight={cellHeight}
|
||||
/>
|
||||
@ -298,7 +300,7 @@ export const RowsList = (props: RowsListProps) => {
|
||||
const indexForPagination = rowIndexForPagination(index);
|
||||
const row = rows[indexForPagination];
|
||||
if (tableState.expanded[row.id] && nestedDataField) {
|
||||
return getExpandedRowHeight(nestedDataField, index, tableStyles);
|
||||
return getExpandedRowHeight(nestedDataField, row.index, tableStyles);
|
||||
}
|
||||
|
||||
return tableStyles.rowHeight;
|
||||
|
@ -597,7 +597,7 @@ describe('Table', () => {
|
||||
|
||||
describe('when mounted with nested data', () => {
|
||||
beforeEach(() => {
|
||||
const nestedFrame = (idx: number) =>
|
||||
const createNestedFrame = (idx: number) =>
|
||||
applyOverrides(
|
||||
toDataFrame({
|
||||
name: `nested_frame${idx}`,
|
||||
@ -626,7 +626,10 @@ describe('Table', () => {
|
||||
{
|
||||
name: 'nested',
|
||||
type: FieldType.nestedFrames,
|
||||
values: [[nestedFrame(0), nestedFrame(1)]],
|
||||
values: [
|
||||
[createNestedFrame(0), createNestedFrame(1)],
|
||||
[createNestedFrame(2), createNestedFrame(3)],
|
||||
],
|
||||
config: {},
|
||||
},
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user