how to filter table when data is from MySQL data base connection

how to filter table when data is from MySQL data base connection

DhrupadDhrupad Posts: 5Questions: 1Answers: 0
edited June 2022 in Free community support

how to filter table when data is from MySQL data base connection. I tried the method shown in https://datatables.net/examples/api/multi_filter.html
but it is using only the first line for searching.

Answers

  • kthorngrenkthorngren Posts: 20,142Questions: 26Answers: 4,736

    but it is using only the first line for searching.

    Please describe this problem in more detail. Better would be a link to your page or a test case replicating the issue so we can help debug.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • DhrupadDhrupad Posts: 5Questions: 1Answers: 0
    edited June 2022


    Please find the above Screenshot for the code used.


    the below screen shot shows the result in the webpage.
    even though a number containing 86 is present in the 1st column's 3rd row the search is comparing only the 1st row and giving "No matching records found" message

  • kthorngrenkthorngren Posts: 20,142Questions: 26Answers: 4,736

    The information element at the bottom left has (filtered from 1 total entries). That suggests you initialized Datatables with one row of data then after initialization added more rows using the above script. Datatables doesn't know about these additional rows. See this FAQ for more details and options.

    Kevin

  • DhrupadDhrupad Posts: 5Questions: 1Answers: 0
    edited June 2022

    ..

  • DhrupadDhrupad Posts: 5Questions: 1Answers: 0

    https://jsbin.com/suqitewicu/edit?html

    please find the full code here. Feel free to Correct it. I am still a beginner.

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
        while(rs.next())
        {
        %>   
        <tbody> 
    

    That's the issue. Move the tbody outside of the white loop. You should only have one tbody for a DataTable.

    Allan

  • DhrupadDhrupad Posts: 5Questions: 1Answers: 0
    edited June 2022

    Already tried it but still the same problem.

    https://jsbin.com/gaxajunaji/edit?html

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    You've still got the closing </tbody> inside the while loop, so I suspect the browser is inferring an extra opening <tbody> since at the moment it will be invalid HTML.

    Allan

Sign In or Register to comment.