Text input filter not finding dynamically added rows.

Text input filter not finding dynamically added rows.

nya13nya13 Posts: 21Questions: 6Answers: 0
edited March 2 in Free community support

So I manually added a new row node/element to my DataTable like this:

dataTable.row.add({ 'Column 1': 1, 'Column 2' }).draw();

But when I go and enter some text to filter the results, that new row is not found. Is there another method I need to call in order to update the DataTable?

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,330Questions: 26Answers: 4,951
    Answer ✓

    Thats the proper way to add rows to the Datatable. However the syntax you have seems incorrect Column 2 doesn't have a value. Likely a copy / paste error.

    I built a test case to show this works:
    https://live.datatables.net/dodobuge/71/edit

    Click the Add Row button then type aaa in the search input.

    If this doens't help then pleaser provide a test case showing the issue so we can help debug.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • nya13nya13 Posts: 21Questions: 6Answers: 0

    ok, thank you for the clear test example. I shall find out where in my side that is preventing the filter from working like it should.

  • kthorngrenkthorngren Posts: 21,330Questions: 26Answers: 4,951

    If you are using server side processing, ie serverSide: true, then row.add() won't work as it is a client side processing function. With server side processing you will need to add the row to the database to have it displayed and searchable by Datatables.

    Kevin

Sign In or Register to comment.