Okay
  Public Ticket #3689670
widget / select which columns to show
Closed

Comments

  • Jeroen started the conversation

    Hi, to use a wpdatatable for a widget, is it possible to select which columns can be showed? Like through the shortcode?

  •  1,846
    Miloš replied

    Hi Jeroen,

    Firstly, I would like to sincerely apologize for the delayed response as we have been experiencing an unusually high number of tickets. I am sorry that it has taken longer than usual to respond to your concern and your patience is highly appreciated.


    Sorry to disappoint you on this, but at the moment, there is no way to achieve dynamic column visibility as you described via Table Shortcode.


    At the moment, you can only allow front-end users the capability to hide or show columns through a checkbox via the Table Tools "Column visibility" button.

    If this button is turned on for the table, your front-end table users will be able to toggle the visibility of the table’s columns. 


    Please note that it also includes the columns that you’ve hidden from the back-end.

    You can un-select the button to hide the column and select it back to show it.

    8869562831.png

    So at the moment, we don't have a way to dynamically show/ or hide columns through the shortcode.

    You can make a future development suggestion, but we can't say an ETA.

    Please feel free to search on our suggestions page

     to see if someone may be already suggested this feature. If you can't see it, feel free to add your suggestion there,  and as more people vote, the feature will move higher on the priority list.

    You can certainly follow our changeLog page if you'd like ( it is also available in the plugin dashboard), where we state any changes/new features/bug fixes during updates;

    and our newsletter, so you're informed about new features, bug fixes, freebies, etc.

    Right now, for the use-case where you need to have different 'views' such as the same data shown with only Column A, B and C for example on Page 1, while Page 2 should show more columns;

    The only workaround is to make multiple SQL Query based tables which call the same source data from your database.

    -


    For example, you can have one main/master Manual table which will store all the data in the database.

    Then, you can check this table's MySQL Table name from the Editing tab in the back-end table settings,

    and you will be able to make multiple SQL tables that pulls data from the same "master table",

    and any editing you do on all these other SQL tables are going to be stored in the same table in the database,

    This will be my example table :

    3791094982.png

    Now, to make a new SQL Table from it,

    first, check in Editing Tab/MySQL table name for editing:

    6795720227.png

    in my example, the Manual table name is wp_wpdatatable_39,

    so i make a new SQL table that will pull data from it;

    and we can choose all columns like :

    SELECT * FROM Table_Name

    or just specific columns;

    we can also have completely different settings/filtering/sorting and limitations for front-end users on each table;

    and you can make multiple SQL Query tables that pull the same data from the "main table".

    SELECT  column_name1,
            column_name2,
            column_name3
    FROM table_name

    -

    In this example, if i want to limit to only show the "Company" column, and i will leave wdt_ID ( because we got to have row ID)  and userid ( if we want userID for limiting rows per currently logged user ID),

    when i hide those columns in the end, the front-end user will only see the "company" column.

    SELECT  wdt_ID,   
         userid,   
        company    
       FROM wp_wpdatatable_39
    4596672496.png

    Later, you can make another SQL Table that will show some other columns, have other filters and so on ( depending on what you need to achieve)...


    So these are the only current ways/alternate workarounds to only load specific columns, etc.

    I hope it helps.

    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