Closed erlingegelund closed 8 months ago
I have the same issue. It seems that the result from ngPipeInstance overwrites data.
Example pipe:
transform(data: State): string {
if (data === State.OK) {
return 'OK';
} else {
return 'NOT OK'
}
}
If State.OK
is passed, the string 'OK' will be returned, but when you change page and go back to this page, data is now the string 'OK' and will return 'NOT OK'.
I also confirm the issue.
The bug can be reproduced in the live example at https://l-lin.github.io/angular-datatables/#/advanced/using-pipe. If you try to re-order rows, the error while be thrown in the console.
As a temporary workaround, you can use the createdCell
callback from datatable, eg:
createdCell: (cell: Node, cellData: any, rowData: any, row: number, col: number) => {
// this.number is injected in the constructor through "private number: DecimalPipe"
$(cell).html(this.number.transform(cellData));
}
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
:beetle: bug report
Using ngPipeInstance, the pipe fails when going back to previous page, causing the whole page to fail
:microscope: Minimal Reproduction
StackBlitz/GitHub Link: https://github.com/erlingegelund/ng-datatables-datepipe
Step-by-step Instructions:
:8ball: Expected behavior
Being able to go back and forth through the pages without errors
:camera: Screenshots
:globe_with_meridians: Your Environment
:memo: Additional context