Skip to main content
Spelling and Grammar
Source Link

OK so I was gearing up to do as suggested by @Jacob above and use the offset and limit clauses on the API server.

However, this really seemed like logic that should be part of the plugin that 'mI'm making rather than the API queries. As such, I thought I'd look into whether any other good/feasable solutions existed.

I have settled on using the Dynatable Jquery Plugin. This plugin actually has a whole host of options available alongside the pagination feature including dynamic searching and sorting of tabular data (both of which I was expecting to have to implement manually).

However, The main reason I have gone for this solution is the ease of installation. All that was required for getting the plugin working (with all of the features) was as follows:

  1. wp_enqueue_script and wp_enqueue_style the files that are included in the download.
  2. Give my table and ID (id="my-table")
  3. Apply the dynatable In my custom scripts by using: $('#my-table').dynatable(); within a $(document).ready call.

It's worth noting that this plugin has a dependency on JQuery, this should be included when you enqueue the script. You also need to (should) declare your JQuery within your custom script using the convention:

(function($) {
    $(document).ready(function() {
       $('#my-table').dynatable();
    });
})(jQuery);

This ensures that the $ shorthand works and doesn't interfere with anything.

I'm currently using it with ot'sthe default settings where. This means it normalizes the data in the table and renders it back but. Due to the time it's saved me, I'll probably look at localizing the script and work with the raw JSOnJSON response I have.

Hopefully this will help other developers shave off a portion of their work day.

OK so I was gearing up to do as suggested by @Jacob above and use the offset and limit clauses on the API server.

However, this really seemed like logic that should be part of the plugin that 'm making rather than the API queries. As such, I thought I'd look into whether any other solutions existed.

I have settled on using the Dynatable Jquery Plugin. This plugin actually has a whole host of options available alongside the pagination feature including dynamic searching and sorting of tabular data (both of which I was expecting to have to implement manually).

However, The main reason I have gone for this solution is the ease of installation. All that was required for getting the plugin working (with all of the features) was as follows:

  1. wp_enqueue_script and wp_enqueue_style the files that are included in the download.
  2. Give my table and ID (id="my-table")
  3. Apply the dynatable In my custom scripts by using: $('#my-table').dynatable(); within a $(document).ready call.

It's worth noting that this plugin has a dependency on JQuery, this should be included when you enqueue the script. You also need to (should) declare your JQuery within your custom script using the convention:

(function($) {
    $(document).ready(function() {
       $('#my-table').dynatable();
    });
})(jQuery);

This ensures that the $ shorthand works and doesn't interfere with anything.

I'm currently using it with ot's default settings where it normalizes the data in the table and renders it back but the time it's saved me, I'll probably look at localizing the script and work with the raw JSOn response I have.

Hopefully this will help other developers shave off a portion of their work day.

OK so I was gearing up to do as suggested by @Jacob above and use the offset and limit clauses on the API server.

However, this really seemed like logic that should be part of the plugin that I'm making rather than the API queries. As such, I thought I'd look into whether any other good/feasable solutions existed.

I have settled on using the Dynatable Jquery Plugin. This plugin actually has a whole host of options available alongside the pagination feature including dynamic searching and sorting of tabular data (both of which I was expecting to have to implement manually).

However, The main reason I have gone for this solution is the ease of installation. All that was required for getting the plugin working (with all of the features) was as follows:

  1. wp_enqueue_script and wp_enqueue_style the files that are included in the download.
  2. Give my table and ID (id="my-table")
  3. Apply the dynatable In my custom scripts by using: $('#my-table').dynatable(); within a $(document).ready call.

It's worth noting that this plugin has a dependency on JQuery, this should be included when you enqueue the script. You also need to (should) declare your JQuery within your custom script using the convention:

(function($) {
    $(document).ready(function() {
       $('#my-table').dynatable();
    });
})(jQuery);

This ensures that the $ shorthand works and doesn't interfere with anything.

I'm currently using it with the default settings. This means it normalizes the data in the table and renders it back. Due to the time it's saved me, I'll probably look at localizing the script and work with the raw JSON response I have.

Hopefully this will help other developers shave off a portion of their work day.

Source Link

OK so I was gearing up to do as suggested by @Jacob above and use the offset and limit clauses on the API server.

However, this really seemed like logic that should be part of the plugin that 'm making rather than the API queries. As such, I thought I'd look into whether any other solutions existed.

I have settled on using the Dynatable Jquery Plugin. This plugin actually has a whole host of options available alongside the pagination feature including dynamic searching and sorting of tabular data (both of which I was expecting to have to implement manually).

However, The main reason I have gone for this solution is the ease of installation. All that was required for getting the plugin working (with all of the features) was as follows:

  1. wp_enqueue_script and wp_enqueue_style the files that are included in the download.
  2. Give my table and ID (id="my-table")
  3. Apply the dynatable In my custom scripts by using: $('#my-table').dynatable(); within a $(document).ready call.

It's worth noting that this plugin has a dependency on JQuery, this should be included when you enqueue the script. You also need to (should) declare your JQuery within your custom script using the convention:

(function($) {
    $(document).ready(function() {
       $('#my-table').dynatable();
    });
})(jQuery);

This ensures that the $ shorthand works and doesn't interfere with anything.

I'm currently using it with ot's default settings where it normalizes the data in the table and renders it back but the time it's saved me, I'll probably look at localizing the script and work with the raw JSOn response I have.

Hopefully this will help other developers shave off a portion of their work day.