• Resolved sameeralam

    (@sameeralam)


    https://gnbl.ca/statistics-2024-2025/

    I have a table with various fields. This is shown in Elementor and I’m using the shortcode to display the table.

    One of the metrics I have is “Active” or “Sub” for each player. I can display that in the table but is there a way to filter using that metric? Or a custom code to filter it.

    ie. Just like I’ve created ‘Show leaderboard’ button, a ‘Hide Sub players’ which would hide all players that have “Sub” in their metric.

    Thanks!

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Savvas

    (@savvasha)

    Hi there @sameeralam ,

    SportsPress uses the DataTables javascript to handle tables. You may give a look here to see how to add custom filters to your tables using some custom script snippets.

    Thanks,
    Savvas

    Thread Starter sameeralam

    (@sameeralam)

    Great, thanks for the info.

    Looking into that example, and this one here (https://datatables.net/examples/api/multi_filter_select.html)

    The only info I know is my player list # (ie. [player_list 4558])

    How do I call/edit my table (ie. where it says “#example”, what do I replace this with)

    newDataTable('#example', {

    ????initComplete: function() {

    ????????this.api()

    ????????????.columns()

    ????????????.every(function() {

    ????????????????letcolumn = this;

    ????????????????// Create select element

    ????????????????letselect = document.createElement('select');

    ????????????????select.add(newOption(''));

    ????????????????column.footer().replaceChildren(select);

    ????????????????// Apply listener for user change in value

    ????????????????select.addEventListener('change', function() {

    ????????????????????column

    ????????????????????????.search(select.value, {exact: true})

    ????????????????????????.draw();

    ????????????????});

    ????????????????// Add list of options

    ????????????????column

    ????????????????????.data()

    ????????????????????.unique()

    ????????????????????.sort()

    ????????????????????.each(function(d, j) {

    ????????????????????????select.add(newOption(d));

    ????????????????????});

    ????????????});

    ????}

    });
    Plugin Contributor Savvas

    (@savvasha)

    Hi @sameeralam ,

    You will need to identify a class selector that will work with all your Player List tables. So instead of using #id_selector you will use .class_selector on your script code.

    Thanks,
    Savvas

    Thread Starter sameeralam

    (@sameeralam)

    Maybe I don’t know enough to utilize the info, hoping you dont mind continuing to assist me.

    https://ctrl.vi/i/x0nloTAJw

    Would I enter the whole thing here (shown above)?

    Creating something like this would be great for me, just not sure how to do it.

    https://live.datatables.net/tafetano/56/edit

    Plugin Contributor Savvas

    (@savvasha)

    Hi @sameeralam ,

    Such kind of custom development is beyond the scope of WP Support forums. You will need to find a freelancer to assist you on this. https://jobs.wordpress.net/ is a great place to search for one ??

    Thanks,
    Savvas

    Thread Starter sameeralam

    (@sameeralam)

    Thanks @savvasha.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.