Further question for "row-selector"

Further question for "row-selector"

BruceeeeeeeeeeBruceeeeeeeeee Posts: 16Questions: 5Answers: 0
edited March 2023 in Free community support

My last question: https://datatables.net/forums/discussion/comment/218849#Comment_218849
Description of problem:
Hello,

Thanks again for y'all help with my last question!
I tried 2 method of the answer and have some new questions:

  • For "column().search()" function, it works good, but it filtering the table, is there a way to reset the filtering page to original page? Right now I can only refresh the web page to cancel this "on-click" function.

  • For "row().show()" function, yes it works well on the livecode, but on my project, it just select the row but still not show on first page, what I did to my code:

  1. Add <script src="https://cdn.datatables.net/plug-ins/1.13.4/api/row().show().js"></script>

  2. Add$('button').on('click', function () { table .rows(function (idx, data, node) { return data[2] === 'my.name' ? true : false; }) .select() .show() .draw(false); });
    So the question 2 is the row().show() function not working on my project, it only select it but not show it.

Thank you so much for the help!

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,144Questions: 26Answers: 4,736
    edited March 2023

    is there a way to reset the filtering page to original page?

    Use column().search() with an empty string to reset the search, for example: table.column( 1 ).search( "" );.

    it just select the row but still not show on first page

    Seems odd. Do you see errors in the browser's console?

    Just make sure the row().show().js is loaded properly. If you see the proper row selected then the chained show() should go to the page. We will need to see the problem to help debug.

    Kevin

  • BruceeeeeeeeeeBruceeeeeeeeee Posts: 16Questions: 5Answers: 0

    Hi @kthorngren ,

    Thanks for your reply!

    For first question, did you mean add a new button with on-click -> table.column(1).search("")
    or
    add .search("") after my code
    .columns(1) .search('bruce.ge') .draw();?

    For second question, yes there got some error on my concole:

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

    did you mean add a new button with on-click -> table.column(1).search("")

    Yes.

    yes there got some error on my concole:

    The error is saying it can't find the show() plugin. Make sure you are loading it in the proper place. Maybe place it last in your list of .js files you are loading. We would need to see this to troubleshoot why the plugin code is not found.

    Kevin

  • BruceeeeeeeeeeBruceeeeeeeeee Posts: 16Questions: 5Answers: 0

    Hi @kthorngren ,

    this is my livecode link:
    https://live.datatables.net/nadanoce/7/edit
    I copy paste what reference link I used on this html page, and it not working on livecode now...Thanks for your patience.

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

    There is no show() method on the API instance returned by the rows() method. The plug-in adds it to row().

    So removing the plural allows it to work as expected.

    Allan

  • BruceeeeeeeeeeBruceeeeeeeeee Posts: 16Questions: 5Answers: 0

    Hi @allan , very appreciate for your help! And thanks Kevin too!

Sign In or Register to comment.