Hey everyone!

With the holiday season upon us, we want to share our upcoming working hours:

After that, we’ll return to our regular schedule and assist you as quickly as possible.

In the meantime, you can explore our documentation for Amelia and wpDataTables. You'll find tons of helpful resources, including articles and handy video tutorials on YouTube (Amelia's YouTube Channel and wpDataTables' YouTube Channel), which might just have the answers you need while we’re away.

Thanks a bunch for your understanding and support!

Warm regards and happy holidays!

TMS

Okay
  Public Ticket #3400579
Ineed to know what data is visible in a wpdatatable
Closed

Comments

  • Karl R Englund started the conversation

    I have a table on a page and I need to know what data is in a table so when a button is pushed I can take action on those records that are visible.

  •  2,572
    Aleksandar replied

    Hello Karl.

    If the table is linked to an existing data source (CSV, Excel, Google Spreadsheet), the plugin fetches all the rows, outputs the entire table to the front end all at once, and then split it into pages using JavaScript; all data processing (page switching, sorting, filtering) is done on the client’s computer by JavaScript.

    wpDataTables with server-side processing enabled fetches only those rows needed on the page at the exact moment. By default, it equals the number of rows that the administrator defines for the table in the “Display length” setting; the front-user can, however, change it. For example: if the table is configured to show 10 rows by default, only 10 rows would be queried from MySQL. When the user switches to the next page, and sorts the table by some column, or filters by some column, an AJAX request is sent to the server, the query is processed by MySQL, and 10 more rows are returned.

    I am not sure what button you're referring to, but it sounds like you'd need to use filters and/or hooks to achieve this. 

    Please note that using hooks requires certain level of programming skills and included support refers only to advice.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  • Karl R Englund replied

    is there any sample code to use a hook or other method to query what filters if any have been set for the current wptable and which rows are displayed?

  •  1,847
    Miloš replied

    Hi, Karl.

    Sorry for the delayed response.

    If we understood, your use-case is for the user to apply some filters,

    and then for you to "save the filtered selection" and to make a custom hook with this.

    As Aleksandar mentioned, custom solutions with hooks such as this are not covered by our support,

    but we do our best to share any working examples when possible for some use-cases.

    -

    For example, this is one where a user wanted to "save the filter selection".

    this bit of custom js will update the browser url (without triggering a reload) to reflect what values have been entered in filters, thereby generating a direct link to the current 'view'. Note this only works for separate filter forms, but should only need a couple of tweaks to do a version for the simple in-table filter boxes ...

    jQuery(window).load(function(){
      wpDataTables.table_1.addOnDrawCallback(function(){
        var params={};
        jQuery('.wpDataTableFilterSection').each(function(i, obj) {
          if ( inputbox = obj.id.match("table_1_(.+)_filter_sections") ) {
            if (jQuery(obj).find('input').val()) {
              var key='wdt_column_filter['+inputbox[1]+']';
              params[key] = jQuery(obj).find('input').val();
            }
          }
        }); 
        history.pushState('','','?'+jQuery.param(params));
      });
    });

    That was an example to save the filter selection.


    2. For using a hook on currently displayed rows,  we don't currently have an example to show you, but we can provide some general guidance.


    Filters (hooks) in WordPress are a type of callback functions that can be defined by the user, and are applied to certain values – strings, integers, objects, etc. It is a simple way to adjust code output without actually having to modify the code. Essentially, you add a given function on top of an existing one, to override the logic. Then, when the plugin is updated later, you won’t lose any of your changes.

    You can get a detailed description on WordPress hooks here in WP Codex. In this section we will go through all the filters available in wpDataTables.

    You can see all our currently available filters here.

    -

    And here you can see our available Actions.

    WordPress Actions provide a convenient way to “hook” into different plugins without changing their code. Basically, “actions” are user-defined functions, assigned to certain labels, that are called by the plugin core at defined moments of its execution. Unlike filters, actions do not return any data, they are simply executed.

    You can read more about using WordPress actions and assigning your functions to actions in WordPress Codex. Here, we will provide a list of actions defined in wpDataTables plugin that you can use to customize it for your needs.

    -

    We hope this helps.

    Please note that using hooks requires certain level of programming skills and included support refers only to advice.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  2,572
    Aleksandar replied

    Hello Karl.

    I'm sorry, but I don't quite understand what you're trying to achieve. Can you please explain in a bit more detail, and I'll check with our developers?

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables