Bottom static row with found data

Bottom static row with found data

Miko55Miko55 Posts: 2Questions: 2Answers: 0
edited September 2018 in Free community support

I have leaderboards with username and users points. Now I want to find logged in user in this table and show his username and points in a static row at the bottom or something like that. I am able to locate user but only if I get on the page where row with his username is.

So first thing would be how to search through all pages as page:'all' doesn't seem to work and how to display that static bar.

        drawCallback: function( settings ) {
        var page = table.page.info();
        if(page.page!=0)
        {
            table.rows( [0,1,2] ).nodes().to$().removeClass('first-place second-place third-place');
        }

        var data = table.rows({ page: 'all' }).data();
        $(data).each( function (idx) {
            var row = table.row( idx );
        
            if ( row.data().username === 'miko55' ) {
                row.nodes().to$().addClass( 'table-success' );
                alert(idx);
            }
        } );
    

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @Miko55 ,

    I'd suggest just using the footer for the static bar, something like this. It doesn't need to go into the drawCallback unless the data is changing. Also, my data is in an array, you'll need to reference an object for yours.

    Cheers,

    Colin

This discussion has been closed.