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

Datatable: Remove Expanded 'td' element returned with 'tr' #3310

Closed
diamanthaxhimusa opened this issue Sep 13, 2022 · 5 comments · Fixed by #3317
Closed

Datatable: Remove Expanded 'td' element returned with 'tr' #3310

diamanthaxhimusa opened this issue Sep 13, 2022 · 5 comments · Fixed by #3317
Assignees
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Milestone

Comments

@diamanthaxhimusa
Copy link

diamanthaxhimusa commented Sep 13, 2022

Describe the feature you would like to see added

Is there any particular reason on why rowExpansionTemplate returns <tr><td /></tr>?

Is your feature request related to a problem?

I need to have same alignment of the expanded view as in the rows

@diamanthaxhimusa diamanthaxhimusa added Status: Discussion Issue or pull request needs to be discussed by Core Team Type: New Feature Issue contains a new feature or new component request labels Sep 13, 2022
@github-actions github-actions bot added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Sep 13, 2022
@melloware
Copy link
Member

I don't understand what you are asking? you define rowExpansionTemplate for what you want rowExpansion to look like? Can you elaborate on your issue or provide a Code Sandbox reproducer?

@melloware melloware added Resolution: Needs More Information More information about the issue is needed to find a correct solution and removed Type: New Feature Issue contains a new feature or new component request labels Sep 13, 2022
@diamanthaxhimusa
Copy link
Author

diamanthaxhimusa commented Sep 13, 2022

@melloware sure here you go https://codesandbox.io/s/elastic-rain-s0wcg7

What I want is when the row is expanded to be able to have same table alignment. When you expand a row in the example I want the price xx with the lightblue background to be aligned with the price column.

To cut it short, I need the Row Expansion to render only the tr and the rest to be handled by me. Thanks.

@melloware
Copy link
Member

I see what you mean. It fills the table width with a colspan and then you fill in the guts.

 <tr id={id} className="p-datatable-row-expansion" role="row">
                        <td role="cell" colSpan={colSpan}>
                            {content}
                        </td>
</tr>

@melloware melloware added Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add and removed Resolution: Needs More Information More information about the issue is needed to find a correct solution Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Sep 13, 2022
melloware added a commit to melloware/primereact that referenced this issue Sep 13, 2022
@melloware melloware removed the Status: Discussion Issue or pull request needs to be discussed by Core Team label Sep 13, 2022
@melloware melloware self-assigned this Sep 13, 2022
@melloware melloware added this to the 8.6.0 milestone Sep 13, 2022
@melloware
Copy link
Member

PR submitted so you will be able to tell the table you want control of the rendering.

This will allow you to take control of the rendering like this..

const rowExpansionTemplate = (data, options) => {
    options.customRendering = true;

    return (
      <>
        <td colSpan={2}>name xx</td>
        <td style={{ background: "lightblue" }}>price template expanded</td>
      </>
    );
  };

@diamanthaxhimusa
Copy link
Author

@melloware great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants