primeng icon indicating copy to clipboard operation
primeng copied to clipboard

[BUG] p-table: selection functionality does not work when passing an ng-template in to a component which wraps the table

Open USLSRV opened this issue 7 years ago • 1 comments

I'm submitting a ... (check one with "x")

[x] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Plunkr Case (Bug Reports)

https://stackblitz.com/edit/github-3cegwc

Current behavior I have created a component which wraps the <p-table> and which uses <ng-template>s for the header and body of the table. When I try to use the selection functionality the <p-tableHeaderCheckbox> is always disabled, the selection property is not updated when the selection changes, and the onRowSelect event does not fire.

Relevant code may be found in the Plunkr TableWrapperComponent.

Expected behavior When passing a template to a component wrapping a <p-table> I expect the selection property to be updated as the user selects rows, the onRowSelect event to fire, and the <p-tableHeaderCheckbox> to not be disabled.

Minimal reproduction of the problem with instructions https://stackblitz.com/edit/github-3cegwc

Use the checkboxes to select any row in this grid. Note that the "Selection" data is not updated, and the console.log to log the selected rows does not occur.

What is the motivation / use case for changing the behavior? This would allow wrapper components around <p-table> to be created, which would reduce development time.

  • Angular version: latest

  • PrimeNG version: latest

  • Browser: all

  • Language: TypeScript

USLSRV avatar Jul 23 '19 20:07 USLSRV

Please use forum for support requests and questions.

cagataycivici avatar Mar 29 '20 13:03 cagataycivici