Okay
  Public Ticket #2640854
Creating distinct views for a table
Closed

Comments

  •  1
    Norm Sash started the conversation

    Hi,

    Is it possible to create distinct (different) views for the same datatable?

    For example, I have a membership site with silver and gold levels.  I have a manually created datatable with 10 columns of data in it.

    The contacts at the 'silver' level can only see columns 1-5, while those at the 'gold' level can see all of the columns.

    What I want to do is have two different views of the datatable set up (maybe displayed with different shortcodes).  I can then have different WP pages set up for the membership levels and have the appropriate Datatables 'view' displayed on each page.

    Can you think of a way to accomplish this with Datatables?  Is there a way to set up different front end views to the same backend Datatable?

    Thanks,

    -Norm

  •  1
    Norm Sash replied

    One way I was thinking of doing this was to create a master Manual Table.  Then create additional tables "from existing data sources" and use the manual table I created as the data source..  But surprisingly I can select many other types of data sources, but there is no option to select a Datatables table as a source.

  •  2,507
    Aleksandar replied

    Hello Norm

    If you want to create a table from a manual table, you need to create it as a table linked to an existing SQL source.

    First, go to the Editing tab of the manual table, and enable editing - check "MySQL table name for editing" and copy it (it'll be something like wp_wpdatatable_15).

    Then create a table linked to an existing source/MySQL and type in this query:

    SELECT * FROM wp_wpdatatable_15

    That will pull all the data from that manual table. The only thing you need to do is hide the wdt_ID column (that's a mandatory column for editable tables, and it's used for assigning row numbers).

    Also, if you already have a table, you can add %VAR1% as a predefined filtering value to a column where "silver" vs "gold" is defined. Then, you can use the same table to be displayed differently on front-end.

    For example [wpdatatable id=15 var1='silver'] will show the table where only "silver" is present in that column; and then [wpdatatable id=15 var1='gold'] will display the table where only "gold" is present in that column.

    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