Okay
  Public Ticket #1642132
Cannot create table via XML or JSON
Closed

Comments

  • Scott Thomas started the conversation

    I am demoing your plugin on a friend's website. He LOVE's your wpDataTables and I am considering purchasing it for a project I am working on.

    However, I cannot create one single table automatically.

    First, I tried using JSON as the source and the URL: https://api.battlemetrics.com/servers?filter[game]=ark&page[size]=100

    When I click apply, I get an error "Please provide a correct format for the cell".

    So, I converted the JSON to XML and tried again to create a table using the XML option and the URL: http://www.extinctioncore.com/temp/test.xml

    SAME ERROR

    If you can help me sort this out, I will gladly purchase the plugin as this will help greatly with many projects.


    Thanks

  • [deleted] replied

    Hi Scott Thomas,
    Thank you for your inquire.

    The problem in the both of these files is the same. Basically files that you are trying to use have more levels that our plugin could understand. From our - Documentation:

    • When working with JSON format please note: Currently, wpDataTables accepts this, and only this, format of JSON (see example): a one-level array of same-structured objects where each object will be parsed as a row, and each field inside of the object as a cell. If your software does not return this format, you would need to prepare, as an example some PHP adapter to return one of the formats that wpDataTables would accept.

    So our suggestion would be to create one PHP file which will fetch data from that JSON/XML and convert it to format that our plugin understand and return in in form of serialize PHP array.

    In the format that you have our plugin could not tell if columns should be data or type, id attributes, or id, name, ip, port.... so you need to convert it to have objects with repeatable array of column names with their values like in the example on our documentation page