Okay
  Public Ticket #2908708
JSON
Closed

Comments

  • Thomas Lopez started the conversation

    Hello, 

    I just purchased your product and I have a question.  We have a client that exposes data through a .net web api.  I know there is the capability to use JSON data with wpDataTables and in a perfect world, we would love to be able use that data directly in wpDataTables.  The URL would be dynamic, but I saw that there seem to be ways to intercept and manipulate that data  and query params via wpdatatables_curl_get_data and such.  I guess I would just like some guidance on whether you thought that this was a good approach, as opposed to the only other thing I can think of, which would be to do curl/guzzle calls to the client's api and then using that resulting json to manually populate some Wordpress custom temp tables (via the WP api).  The upside of this (I would imagine) is that now we are 100% in Wordpress' world and everything should work smoothly in wpDataTables.  The downside would be us having to clear and repopulate data each time with this approach, and on top of that, the customer would need to see only their own data.  Sorry for the long question, but I just don't want make sure that I don't go down the wrong rabbit whole.  Thanks in advance!

    Tom

  • [deleted] replied

    Hi Thomas

    Thank you for reaching out to us.

    With this hook you can override the JSON URL used to create the table. You can also use placeholders as query parameters in the JSON URL to filter data for the logged-in user if the user values are the same in API as in WP. You can also use placeholders after (not in the URL itself) to filter data for the logged in user. You can also custom prepare data through PHP serialized array to capture data via curl to filter it and display only what you need.



  • Thomas Lopez replied

    Hi Blazenka,

    Thanks for getting back to me so quickly.  I assume when you're talking about placeholders, you're referring to variables that I can use in the PHP code? I also have a quick question about paging.  Whether I'm using the JSON approach or directly connecting to WP data to the wpDataTable, is the paging done on the server-side, or is all the data brought into the wpDataTable at once, and then paged on the client-side?

    Thanks again!

    Tom

  •  2,572
    Aleksandar replied

    Hello Thomas.

    We have predefined placeholders in wpDataTables, that you can use as predefined filtering values in the table. There are 3 variable placeholders (user-defined), and 6 predefined placeholders.

    JSON tables are tables linked to an existing data source, and as such don't offer server-side processing, so they are loaded on a page and split into pages using JS.

    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