Ngx-datatable: Button in column doesn't work after vertical scroll

Created on 6 Dec 2017  路  6Comments  路  Source: swimlane/ngx-datatable








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

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, post on Stackoverflow or Gitter

Current behavior

I have created a ngx-datatable with one column that has a button inside of it. this button click works fine when i load the route with the datatable, however when i scrol in the table and click it again it doesnt work anymore somehow?
Expected behavior

The button should always work even if i have scrolled a bit down through the table.
Reproduction of the problem

So the first image shows the freshly loaded component with the ngx-datatable. When i click the button (marked) in red, the router routs to another page and works fine. However when i re-run the application and scroll down a bit after the component is loaded (see image 2). The same button doesnt work anymore and gives the following result (see image 3).

image1

image2

image3

SO MY QUESTION WHY DOES VERTICAL SCROLLING AFFECT THE EXECUTION OF THE BUTTON, NOTHING CHANGES EVEN IF I CONSOLE.LOG(EVERYTHING I PASS TO THE METHOD FROM THE TABLE)????
What is the motivation / use case for changing the behavior?

see description above

Please tell us about your environment:

windows 10, Visual studio code, npm

  • Table version: 0.8.x

    latest table version
  • Angular version: 2.0.x

    latest angualr version (5.0)
  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

    all
  • Language: [all | TypeScript X.X | ES6/7 | ES5]
    latest typescript

Most helpful comment

I have the same problem any solutions ?

All 6 comments

I have the same problem any solutions ?

Tengo el mismo problema, hace mas de un mes que esta la pregunta, espero una respuesta r谩pida si puede ser.

This is still an issue for me haven't fixed it and I also asked this question on stackoverflow. But nobody could help us as well. Hopefully there will be a fix soon.

Hello ,

I got a temporary quick fix :
On button in Dom :
(click)="execFunctionInTable.next({functionName:'Name of your function',parameters:[parameters]})"
In component :
public execFunctionInTable = new Subject<{functionName:string,parameters:Array<any>}>();
In constructor component :
private ngZone: NgZone (import NgZone from @angular/core)
In constructor or ngOnInit component :

this.execFunctionInTable.subscribe(value => {          
            this.ngZone.run(()=>{
                this[value.functionName](...value.parameters);
            })
          })

This way button execute normally after scrolling.

@Samuel4321 You Sir are my hero, the temporary fix works!!! Thank you so much <3

Why is the issue closed? The provided solution is just a workaround.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alceucardoso picture alceucardoso  路  3Comments

dinvlad picture dinvlad  路  3Comments

TakhirMamirov picture TakhirMamirov  路  3Comments

lautarobock picture lautarobock  路  3Comments

id1945 picture id1945  路  3Comments