Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

[Tabs][Datagrid]Initial column width for datagrid column appearing as zero #3273

Closed
winstonfernandes opened this issue Apr 4, 2019 · 10 comments

Comments

@winstonfernandes
Copy link

Describe the bug

When datagrid is placed within tabs the initial width of column header is appearing as zero due to this there are alignment issues when minimum column width is provided. When the column
is resized the widths are updated correctly

How to reproduce

https://stackblitz.com/edit/clarity-dark-theme-v1-0-datagrid-issue

Check the width of the column during after initial rendering.

Steps to reproduce the behavior:

  1. Create datagrid in tabs
  2. check the column width

Expected behavior

The column width should be non-zero after initial rendering

Versions

App

Angular: 7.2
Clarity: 1.1.2
Device:

OS: [Windows Server 2012]
Browser [Chrome]
Version 72.0.3626.121

Width_Zero

@hippee-lee
Copy link
Contributor

hippee-lee commented Apr 4, 2019

Hi there,

I looked at the example (thank you for that). It looks like there were some implementation issues that were causing the misalignment. It's hard to tell what the data should be but when I clean up the template and declare the datagrid as described by the documentation for binding properties, then column widths work as intended.

I'm closing this as it doesn't seem to be an issue. If you have more questions about getting the datagrid up and running please ask on stack overflow and tag it with vmware-clarity.. If I misunderstood what the datagrid was trying to do please let me know.

Here is a working version of the original example: https://stackblitz.com/edit/gh-3273-datagrid-column-width-question

@winstonfernandes
Copy link
Author

The working version still shows the width as zero
image

@winstonfernandes
Copy link
Author

Proper width is shown on resizing any column. Please let me know if my understanding is wrong. There will be alignment issues if min-width is required on the column. The screenshot after resizing is attached.
image

@hippee-lee
Copy link
Contributor

There is something odd with your example code but I didn't dig deep enough to figure out exactly what. I checked with a simple datagrid that column widths are calculating as expected: https://stackblitz.com/edit/datagrid-simple-columnwidth

If this issue is happening in a production app, then I would suggest starting with the simplest grid you can e.g hard coded (like in the example) and then adding on more complexity (real data and real interpolation of the data for the names and values in headers and cells).

@winstonfernandes
Copy link
Author

The issue occurs when the datagrid is present in vertical tabs. For some of the pages we are required to keep the datagrid within vertical tabs. Please let us know if there is a work around for this. Can you please re-open this issue because we are seeing this issue whenever datagrids are present in vertical tabs. In our case this happens to be a major use case. Let us know if there is any other information required.

@hippee-lee
Copy link
Contributor

Hi there. It sounds like from the last comment this is with a vertical tabs layout, correct? I'll re-opan and label this as waiting for more information.

Please provide a reproduction with stackblitz that demonstrates the issue. For simplicity, please fork the simple datagrid stackblitz from above and add your vertical tabs code to it.

@hippee-lee hippee-lee reopened this Apr 8, 2019
@hippee-lee hippee-lee added status: needs info Need more information from the issue author. flag: watchlist labels Apr 8, 2019
@winstonfernandes
Copy link
Author

I have updated the code. The issue is seen with the latest version of clarity. Not sure after which version it stopped working. The issue can be seen with 1.1.2. Working fine till 1.0.4. The reproduction with stackblitz attached. I have updated the clarity version. The link https://stackblitz.com/edit/datagrid-simple-columnwidth-with-tabs.

@hippee-lee hippee-lee added status: needs triage and removed status: needs info Need more information from the issue author. labels Apr 9, 2019
@hippee-lee
Copy link
Contributor

Thanks for the reproduction. It seems like a lifecycle issue and will need more investigation.

@Jinnie
Copy link
Contributor

Jinnie commented Apr 16, 2019

I researched it a bit, though I don't yet have a solution.
The width is applied as part of the header renderer directive, which listens to changes on a column state object.
What changed on the tabs is that content used to be directly projected there with ng-content while now we're iterating over the contents children and applying their exposed templates one by one.
As @hippee-lee said, this probably leads to lifecycle issues, by changing the order of initialization of the templates vs the renderer directive.

@Jinnie Jinnie self-assigned this Apr 23, 2019
Jinnie added a commit to Jinnie/clarity that referenced this issue Apr 24, 2019
)

Datagrid column sizing lifecycle was calculating column widths
when tab-content was not yet attached to the DOM, resulting in
width: 0px.
Partly reverted the projection back to ng-content.
Added integration test to verify this scenario.

Signed-off-by: Ivan Donchev <idonchev@vmware.com>
Jinnie added a commit that referenced this issue Apr 30, 2019
* [NG] Fix datagrid column sizing inside *clrIfActive (#3273)

Datagrid column sizing lifecycle was calculating column widths
when tab-content was not yet attached to the DOM, resulting in
width: 0px.
Partly reverted the projection back to ng-content.
Added integration test to verify this scenario.

Signed-off-by: Ivan Donchev <idonchev@vmware.com>
Jinnie added a commit to Jinnie/clarity that referenced this issue Apr 30, 2019
…#3273)

Viewchild setter initialization of ref in service, as advised by Shijir.
This overcomes latency in the initialization of the container vs the
templated content.

Signed-off-by: Ivan Donchev <idonchev@vmware.com>
Jinnie added a commit to Jinnie/clarity that referenced this issue Apr 30, 2019
…#3273)

Viewchild setter initialization of ref in service, as advised by Shijir.
This overcomes latency in the initialization of the container vs the
templated content.

Signed-off-by: Ivan Donchev <idonchev@vmware.com>
hippee-lee pushed a commit to hippee-lee/clarity that referenced this issue May 6, 2019
) (vmware-archive#3318)

* [NG] Fix datagrid column sizing inside *clrIfActive (vmware-archive#3273)

Datagrid column sizing lifecycle was calculating column widths
when tab-content was not yet attached to the DOM, resulting in
width: 0px.
Partly reverted the projection back to ng-content.
Added integration test to verify this scenario.

Signed-off-by: Ivan Donchev <idonchev@vmware.com>
Jinnie added a commit that referenced this issue May 7, 2019
* [NG] Lifecycle fix for tabs templating initialization (#3273)

Viewchild setter initialization of ref in service, as advised by Shijir.
This overcomes latency in the initialization of the container vs the
templated content.

Signed-off-by: Ivan Donchev <idonchev@vmware.com>
@Jinnie Jinnie closed this as completed May 7, 2019
@hippee-lee hippee-lee reopened this May 14, 2019
Jinnie added a commit that referenced this issue Jun 3, 2019
Viewchild setter initialization of ref in service, as advised by Shijir.
This overcomes latency in the initialization of the container vs the
templated content.

(cherry picked from commit 7135fce)

Signed-off-by: Ivan Donchev <idonchev@vmware.com>
@github-actions
Copy link

github-actions bot commented Sep 9, 2020

Hi there 👋, this is an automated message. To help Clarity keep track of discussions, we automatically lock closed issues after 14 days. Please look for another open issue or open a new issue with updated details and reference this one as necessary.

@github-actions github-actions bot locked and limited conversation to collaborators Sep 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants