Skip to content

Add grid "Open To Depth" functionality #4004

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 24 commits into
base: develop
Choose a base branch
from
Open

Conversation

febbraiod
Copy link
Member

@febbraiod febbraiod commented May 27, 2025

Hoist P/R Checklist

Pull request authors: Review and check off the below. Items that do not apply can also be
checked off to indicate they have been considered. If unclear if a step is relevant, please leave
unchecked and note in comments.

  • Caught up with develop branch as of last change.
  • Added CHANGELOG entry, or determined not required.
  • Reviewed for breaking changes, added breaking-change label + CHANGELOG if so.
  • Updated doc comments / prop-types, or determined not required.
  • Reviewed and tested on Mobile, or determined not required.
  • Created Toolbox branch / PR, or determined not required.

If your change is still a WIP, please use the "Create draft pull request" option in the split
button below to indicate it is not ready yet for a final review.

Pull request reviewers: when merging this P/R, please consider using a squash commit to
collapse multiple intermediate commits into a single commit representing the overall feature
change. This helps keep the commit log clean and easy to scan across releases. PRs containing a
single commit should be rebased when possible.

@febbraiod
Copy link
Member Author

Corresponding TB PR:

xh/toolbox#764

…OW_LEVEL_OPENER

# Conflicts:
#	CHANGELOG.md
@@ -81,6 +81,11 @@ export interface ActionFnData {
[x: string]: any;
}

export interface DisplayFnData extends ActionFnData {
/** Default display config for the action */
defaultConfig?: PlainObject;
Copy link
Member

Choose a reason for hiding this comment

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

Could we type this now? We have described the object exactly as well as what we pull off of it (the return from getDisplaySpec(). Trying to stamp out these PlainObject types where possible.

Then we could also type the return, from RecordActionSpec:

/** Function called prior to showing this item. */
    displayFn?: (data: DisplayFnData) => PlainObject;

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll take a look

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this might be cruft. Don't think this defaultConfig is set or used anywhere.

@@ -33,7 +33,7 @@ export type GridContextMenuToken =
| 'autosizeColumns'
| 'copyCell'
| 'colChooser'
| 'expandCollapseAll'
| 'expandCollapse'
Copy link
Member

@amcclain amcclain Jun 2, 2025

Choose a reason for hiding this comment

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

We should call out this change in the changelog - apps might be using this token directly in cases where they have taken over returning what should / should not be in the context menu.

I don't think it needs to rise to the level of a major version breaking change, but it does warrant some mention of it. (We have a few cases where we call out a very minor breaking change with a ⚠️ Note: intro.)

Copy link
Member Author

Choose a reason for hiding this comment

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

ok

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually I don't think I intended to make this change. I had left support for this in the MenuSupport file. Lee and I both thought it would be good to support this for backward compatibility.

} else {
agApi.forEachNode(node => {
node.setExpanded(node.level < this.expandToLevel);
});
Copy link
Member

Choose a reason for hiding this comment

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

I was wondering how this iteration over every node holds up with very large grids. Tried our Toolbox Admin > Tests > Grid page. Allowed it to load its default (if intense) 200k records, the swapped to tree mode. All OK, but then tried expanding to level three and the tab locked up with 100% CPU for...well, I gave up waiting.

Note that this does not occur with pre-existing expand/collapse all - I can use the toggle in the tree column header and the app is able to execute that operation OK and remain responsive.

Checking first to see how you were looking at / thinking about performance here, happy to discuss what we could do....

Copy link
Member

Choose a reason for hiding this comment

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

In similar code in a client app we are setting the expanded property on the row nodes directly and then calling agApi.onGroupExpandedOrCollapsed() after updating all the nodes, might be worth trying to see if that performs better

Copy link
Member Author

Choose a reason for hiding this comment

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

Will give it a try

Copy link
Member Author

@febbraiod febbraiod Jun 6, 2025

Choose a reason for hiding this comment

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

This appears to improve things by a lot.

@amcclain
Copy link
Member

Hi - I know that things have been even more busy than usual with client work for you @febbraiod , but just catching up and saw your note re. change to bulk-setting expanded flag on nodes improving things "a lot" - sounded promising :)

I'm eager to check out the latest and see how things perform, get a sense of what else (if anything) we'd need to address before we could merge and release. Give a shout here please if any known TODOs or blockers, discussion items, etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants