Skip to content
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

feat(data-table): Add resizing feature for columns #785

Open
wants to merge 5 commits into
base: next
Choose a base branch
from

Conversation

srivalli-sivaramasankaran
Copy link
Collaborator

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • My commits have standard messages as mentioned in Contributing Guidelines

How Has This Been Tested?

}

resizeCol(e) {
const targetCol = e.path[0];
Copy link
Collaborator

Choose a reason for hiding this comment

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

replace it with composedPath. or do a check to see if e.path exists if not use composedPath

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

@@ -1158,10 +1205,19 @@ export class DataTable {
}
></fw-checkbox>
)}
{this.colResize && (
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you move this to a function/variable which return this JSX element and use it in other places. I see some repetition of this code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

@Watch('colResize')
handleColResize() {
setTimeout(() => {
this.colResize && this.setResizerHeight();
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we rename it to setColResizerHeight to make it more descriptive?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

const targetCol = e.path[0];
targetCol.classList.add('resizer-border');
const currentMousePos = e.clientX;
const parent = e.path[0].parentElement;
Copy link
Collaborator

Choose a reason for hiding this comment

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

replace it with composedPath. or do a check to see if e.path exists if not use composedPath

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed.

if (resizers.length > 0) {
resizers.forEach((item: HTMLElement) => {
item.style.height =
this.el.shadowRoot.querySelector('table').offsetHeight + 'px';
Copy link
Collaborator

Choose a reason for hiding this comment

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

can u move this line above the forEach statement. This is create reflow for every iteration since we are reading offsetHeight on each iteration. This value will remain constant.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed.

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.

2 participants