Skip to content

Fix last row label state after collapse and expand#2895

Closed
tarekquao wants to merge 2 commits intoperspective-dev:masterfrom
tarekquao:fix-last-row-label-state-after-collapse-and-expand
Closed

Fix last row label state after collapse and expand#2895
tarekquao wants to merge 2 commits intoperspective-dev:masterfrom
tarekquao:fix-last-row-label-state-after-collapse-and-expand

Conversation

@tarekquao
Copy link
Contributor

This fixes the issue found in #2368 where in a grouped state (within Datagrid), the last grouped row header seemed as if it had been already unfolded showing the (-) sign instead of the (+) sign.
Now the last grouped row rightly shows the (+) sign.

Pull Request Checklist

  • Description which clearly states what problems the PR solves.
  • Description contains a link to the Github Issue, and any relevent
    Discussions, this PR applies to.
  • Include new tests that fail without this PR but passes with it.
  • Include any relevent Documentation changes related to this change.
  • Verify all commits have been signed in accordance with the DCO policy.
  • Reviewed PR commit history to remove unnecessary changes.
  • Make sure your PR passes build, test and lint steps completely.

Signed-off-by: Tarek Quao <tarek.quao@turntabl.io>
Signed-off-by: Tarek Quao <tarek.quao@turntabl.io>
const totalHeader = await page.locator('th:has-text("TOTAL")').first();

await totalHeader.click();
await totalHeader.click();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use View::set_depth for this.

dy: metadata.y - metadata.y0 + 1,
});

const is_last_item = !next || next.row_header === undefined;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only checks whether the row is the last row in the viewport, not the dataset. it just makes the last row visible on screen always appear folded.

Screen.Recording.2025-02-09.at.9.03.15.PM.mov

@texodus
Copy link
Member

texodus commented Feb 10, 2025

Thanks for the PR, but I don't think this approach is going to work. I can see two potential approaches:

  1. Capture an n + 1 sized window in the dataListener, then use this row to determine the collapse state. We'd need to be careful to make sure the extra row doesn't get rendered or we'll end up with the same problem.
  2. Add an explcit View API to fetch this data, which is beyond the scope of this comment.

@texodus texodus closed this Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants