Okay
  Public Ticket #3378137
I need to know how to do an specific filter
Closed

Comments

  • Ricardo started the conversation

    Hi,

    I need to display a chart that will be built from data found in a MySQL table located in the same wordpress server (I already know how to do this), and I need the user from the frontend page to be able to select a certain date, and the result of the chart to change depending on that date (i.e. the date must be used as a filter or search condition in the SQL query).

    Is it possible to achieve this in wpDataTable, how?


  •  1,708
    Miloš replied

    Hi, Ricardo.

    Yes, you can achieve this with a workaround, to load a table in the "background of the page", while hiding the main table and only showing the filters  and the chart.

    I will describe this in more details :

    By default, the charts will not follow any filtering from their source table if you just put the chart "on its own" on the page.

    But If you place the source table together with its chart on the same page,

    and activate " Follow Table filtering"  on the chart Wizard settings,  it is going to follow any filtering/sorting you do on the table.

    -

    Now, depending if you wish to hide the table and have a filtering for Charts, we can have two workarounds available.

    1. If you wish to hide the entire table along with table filters;

    you can add this CSS to the table's back-end settings/Customize/Custom CSS.

    .wpdt-c .wpDataTables.wpDataTablesWrapper {
    display: none !important;
    }

    This will completely hide the table from the page, but you can still pass the table shortcode with the chart, and you will get the "follow table filtering" effect on this chart.

    2. Or if you wish just to hide the table while leaving the filters with the chart,

    we would first need to disable the following in the table settings:

    "Show X entries" drop-down; "Info Block" from Display tab:

    5739555450.png

    Then, "Enable main search block"  and "show filters in a form above the table" from the Sorting and Filtering tab:

    7822122957.png

    Then, you can add this CSS in the table settings/Customize/Custom CSS:

    .wpdt-c .wpDataTablesWrapper table {
    display: none !important;
    }
    

    That will just leave the chart visible with the filters on the page,

    if you pass both table and chart shortcodes.

    Let me know if that helps.smile.png

    Kind Regards, 

    Miloš Jovanović
    [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

  •  1,708
    Miloš replied


    Hi, Ricardo.

    I just forgot to add one important point , in regards to which rows from the table will load on the Chart.

    The charts are being created based on tables. If the table is server-side enabled, then only the rows shown in the table will be loaded on the chart.

    If the table is non-server-side, the chart will load all the rows, unless we enable "Follow table filtering" with the table on the same page.

    -

    Basically, if you have a Manual table; they have automatically server-side enabled, we can't disable it.

    So you would have to make another SQL Query based table, to pull data out of the Manual Table;

    then you have to disable server-side processing for it;

    and disable "Follow table filtering" - then the chart will load all rows ( if needed).

    -

    And i just wanted to point out that you can try wpDataTables before purchasing

     on our sandbox Demo sites ( you can find links for the main plugin Demo,  

    as well as add-on Demos, in my signature),

    and there is a 15-day money-back guarantee period, 

    so if you purchase the plugin, you can safely fully test it out, and if it doesn't fit your needs you can request and receive a refund in that period. ( same goes for all plugins and add-ons)

    Let me know if you have any additional questions. smile.png


    Kind Regards, 

    Miloš Jovanović
    [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