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

[Table] pass full row object to _renderRow #496

Closed
vNakamura opened this issue Aug 16, 2018 · 0 comments
Closed

[Table] pass full row object to _renderRow #496

vNakamura opened this issue Aug 16, 2018 · 0 comments
Assignees

Comments

@vNakamura
Copy link
Member

At line 198, parentRow gets the remaining properties of row

const { [rowGroupKey]: childRows, ...parentRow } = row;

Then it's passed to _renderRow
{!shouldUngroup && this._renderRow(parentRow, index, "", true)}

But we have a use case where we need to render the quantity of child rows at the parent row, so we need access to the child rows array as well.

 

Full function for reference:

_renderRowGroup = (row, index) => {
const { rowGroupKey, flatGroupCondition } = this.props;
const { [rowGroupKey]: childRows, ...parentRow } = row;
const shouldUngroup = !!(flatGroupCondition && flatGroupCondition(row));
const rowKey = getRowKey(index, "");
const expanded =
shouldUngroup ||
!this.props.collapsed ||
this.state.expandedRows.includes(rowKey);
return (
<tbody className={`body ${!expanded ? "collapsed" : ""}`} key={index}>
{!shouldUngroup && this._renderRow(parentRow, index, "", true)}
{childRows.map((row, subindex) =>
this._renderRow(row, index, subindex, false, shouldUngroup)
)}
</tbody>
);
};

vNakamura added a commit that referenced this issue Aug 16, 2018
affects: @crave/farmblocks-table

including the array with the sub rows objects

ISSUES CLOSED: #496
vNakamura added a commit that referenced this issue Aug 16, 2018
affects: @crave/farmblocks-table

including the array with the sub rows objects

ISSUES CLOSED: #496
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants