I have a problem with duplicated pagination & search bar, can someone help me out?

I have a problem with duplicated pagination & search bar, can someone help me out?

FoxvoreFoxvore Posts: 1Questions: 1Answers: 0

Answers

  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin

    What is happening is that the DataTable is being re-initialised, without previously having been destroyed, but also that the DOM node is not the original (i.e. the HTML has been over written).

    Here is a really simple demonstration of that: http://live.datatables.net/lavigiji/1/edit .

    If you hadn't included the mounted() function I wouldn't have known what was going on so quickly, but when your component is destroyed and then remounted, it will appear. You don't say, and haven't included a test case as we ask for, but I'd guess it works the first time it is mounted, then you get what you showed above on the second time, then the third time there are three controls, etc.

    Probably the easiest fix in this case is to call destroy() in an unmount hook.

    Allan

Sign In or Register to comment.