Okay
  Public Ticket #3083806
Open template page on same tab
Closed

Comments

  • Gary Mattox started the conversation

    WpDataTables v4.4

    When a user clicks on a table row, a template page opens in a seperate tab.  Can a table be configured to open the template page in the same tab when a row is clicked?

    Opening in a seperate tab makes it very difficult for iphone users to navigate back to the original page containing the table.  

  •  2,572
    Aleksandar replied

    Hello Gary

    Unfortunately, there is no built-in option at the moment, but we will add it in one of the next updates.

    You can change it in code in file wp-content/plugins/wdt-master-detail/class.masterdetail.wpdatacolumn.php around line 51 you will find this

    $formattedValue = "<form class='wdt_md_form' method='post' target='_blank' action='{$renderAction}'>
                                           <input class='wdt_md_hidden_data' type='hidden' name='wdt_details_data' value=''>
                                           <input class='master_detail_column_btn {$buttonClass}' type='submit' value='{$buttonLabel}'>
                                           </form>";

    and you have to change target="blank" to target="_self"

    $formattedValue = "<form class='wdt_md_form' method='post' target='_self' action='{$renderAction}'>
                                           <input class='wdt_md_hidden_data' type='hidden' name='wdt_details_data' value=''>
                                           <input class='master_detail_column_btn {$buttonClass}' type='submit' value='{$buttonLabel}'>
                                           </form>";

    also in the same file on line 64, you will find this

    $formattedValue = "<form class='wdt_md_form' method='post' target='_blank' action='{$renderAction}'>
                                           <input class='wdt_md_hidden_data' type='hidden' name='wdt_details_data' value=''>
                                           <input class='master_detail_column_btn md-link' type='submit' value='{$content}'>
                                           </form>";

    and you have to replace it with this:

    $formattedValue = "<form class='wdt_md_form' method='post' target='_self' action='{$renderAction}'>
                                           <input class='wdt_md_hidden_data' type='hidden' name='wdt_details_data' value=''>
                                           <input class='master_detail_column_btn md-link' type='submit' value='{$content}'>
                                           </form>";

    Then, go to wp-content/plugins/wdt-master-detail/templates/md_modal.inc.php and change line 52 just like you did the others, so change this:

    <form  class='wdt_md_form' method='post' target='_blank' action='<?php echo $renderAction; ?>'>
                    <input class='wdt_md_hidden_data' type='hidden' name='wdt_details_data' value=''>
                    <input class='master_detail_column_btn' type='submit' value='Submit'>
                </form>

    To this:

    <form  class='wdt_md_form' method='post' target='_self' action='<?php echo $renderAction; ?>'>
                    <input class='wdt_md_hidden_data' type='hidden' name='wdt_details_data' value=''>
                    <input class='master_detail_column_btn' type='submit' value='Submit'>
                </form>

    That one's for row click.

    Basically, look only for "target='_blank'" and change it to "target="_self'" and that's it.

    I hope that helps.

    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

  • Gary Mattox replied

    Thanks Aleksandar, your solution worked perfectly.  It's a big win for our iphone users..!

    Thanks again,

    Gary

  •  2,572
    Aleksandar replied

    You're welcome, Gary.

    Keep in mind that you'll need to do this again when the plugin updates, until we include it in the plugin.

    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