Okay
  Public Ticket #2691106
Link from a value
Closed

Comments

  • Marco started the conversation

    Hello,

    I have some data in one table and would like to open another table on another page based on the value I'm clicking. To try to be more precise, I would like to open a table: by clicking on the value present in a cell, for example an id, I would like to open a table referring to that value.

  •  472
    Isidora replied

    Hi Marco,

    Thank you for your purchase
    Sorry for the delay in our responses, has been national holidays in our country for the last two days.

    Well we don't have this built-in function, but you can try it next but you will need some experience with writing SQL queries and using WP hooks.

    You can create a table with a query for example

    SELECT 
    user_id, 
    user_name, 
    user_address,
    CONCAT('<a href="http:/yoursite.com/your_custom_page?user_id=',user_id,'">Details</a>') AS Details
    FROM your_table_name

    and then on your_custom_page, you will insert a shortcode of the tableID that you need with a placeholder like this

    [wpdatatable id=1 var1=1]

    of course, you will create that second table from a query like

    SELECT * FROM second_table WHERE user_id = %VAR1%

    and then you will use our hook for dynamic upsetting placeholders(you will insert this in functions.php file of your theme or child theme)

    function updateVAR1($tableID){
      global $wdtVar1;
          //check is set GET parametar user_id
        if(isset($_GET['user_id'])){
            //get value from form fieald
            $wdtVar1 = $_GET['user_id'];
        }
      }
    add_action('wpdatatables_before_get_table_metadata', 'updateVAR1');

    Like this, I believe you will get a result as you need

    If you don't have an SQL table, then there is also a workaround but with our add-on Master-detail and some hooks.

    Let me know if you are interested in this.



    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables