• I have added the script below to make each row clickable. My goal is to retrieve row $a and column-1 ‘s text so I can run the search with just that row. My employer wishes only that row to appear once clicked.

    Does anyone know the code for retrieving the text with Table Press?

    It would also save me time if someone knew to do run the search with a particular text in the script.

    <script type=”text/javascript”>
    jQuery(document).ready(function($){
    $(‘.tablepress-id-1’).on( ‘click’, ‘tr’, function() {
    ….
    } );
    });
    </script>

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Megajairus

    (@megajairus)

    <script type=”text/javascript”>
    jQuery(document).ready(function($){

    $(‘.tablepress-id-1 tbody’).on( ‘click’, ‘tr’, function () {
    var $a = $(this).find($(‘td’)).first();
    var new_search_text = $(‘.tablepress-id-1’).DataTable().cell(this,0).data();
    var short_text = new_search_text.substring(0,10);
    $(‘.tablepress-id-1’).DataTable().search(short_text).draw();
    } );
    });
    </script>

    for anyone wondering. If anyone has a better way, let me know

    Hi,

    great to see that you already found a solution, looks good!

    Best wishes,
    Tobias

    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Table Press Find element in row’ is closed to new replies.