Problem with row icons after using fnAddData()

Problem with row icons after using fnAddData()

adrianFerreiraadrianFerreira Posts: 9Questions: 2Answers: 0

This is my situation.

This is my JS File:
https://gist.github.com/adrianferr/552ee7d9d6caf965be52a82c8fd4ce4f

and my JSP File:
https://gist.github.com/adrianferr/504db25128aea115becc1b808af8f65d

As you can see, I have a third row with two icons, classic delete and edit.

After adding a row with fnAddData, the icons on the row have no response to the on(click) event. All the other rows are still working fine.

the on(click) events por editand delete are on js file lines 363 and 411.

Any help will be amazing. Thanks a lot in advance.

Answers

  • tangerinetangerine Posts: 3,350Questions: 37Answers: 394

    Is this related to your other thread
    https://datatables.net/forums/discussion/62823/problems-using-fnupdate-with-datatables-1-9-4#latest

    in which you have repeatedly been asked to provide a test case?

  • adrianFerreiraadrianFerreira Posts: 9Questions: 2Answers: 0

    Its related, but not the same.

    When I tried to update a row, i'm no able to do it.

    But when I add a row, i'm no able to use the icons of my row.

    I have already give all my code. I dont know what a test case is. I have seen other post solved just showing the code. Please help.

  • tangerinetangerine Posts: 3,350Questions: 37Answers: 394

    Colin already explained that you should go to http://live.datatables.net/ .
    There you should recreate the code necessary to demonstrate the problem.

  • adrianFerreiraadrianFerreira Posts: 9Questions: 2Answers: 0

    tangerine, sorry, can any one of you help me? I dont know how to replicate on the live.datatable.net web my code situation. I'm kinda desperate, I have to solve this for my work.

  • kthorngrenkthorngren Posts: 20,322Questions: 26Answers: 4,774
    edited June 2020

    The test case doesn't need to replicate your full environment. It just needs to show the problem. Build a few rows of your table to show working buttons and add a row to show the buttons not working. The button can call a function that simply uses console.log to show that its working. The actual data doesn't matter.

    I didn't look through all the code to figure out what you are doing so not sure how you are setting up your events. However you may want to follow the example presented here using jQuery delegated events:
    https://datatables.net/examples/advanced_init/events_live.html

    Kevin

  • adrianFerreiraadrianFerreira Posts: 9Questions: 2Answers: 0

    I have finaly solved the problem adding an evenListener to all icons with my class. Thanks for all the support.

This discussion has been closed.