Answers.Body: <p>I have found the Problem, Problem was inside pager.tpl</p>
  <p>pager.tpl generate some js to handle ajax page loading When pager.tpl location variable != top</p>
  <p>That's js look like this without compiled(in pager.tpl):</p>
  <pre><code>{if $location neq 'top'}
    &lt;script type=&quot;text/javascript&quot;&gt;
      {literal}
      CRM.$(function($) {
        {/literal}
        var
          $form = $({if empty($form.formClass)}'#crm-main-content-wrapper'{else}'form.{$form.formClass}'{/if}),
          numPages = {$pager-&gt;_response.numPages},
          currentPage = {$pager-&gt;_response.currentPage},
          perPageCount = {$pager-&gt;_perPage},
          currentLocation = {$pager-&gt;_response.currentLocation|json_encode},
          spinning = null,
          refreshing = false;
        {literal}
        function refresh(url) {
          if (!refreshing) {
            refreshing = true;
            var options = url ? {url: url} : {};
            $form.off('.crm-pager').closest('.crm-ajax-container, #crm-main-content-wrapper').crmSnippet(options).crmSnippet('refresh');
          }
        }
  
        ...
  
        $form
          .on('click.crm-pager', 'a.ui-spinner-button', function(e) {
            var $el = $(this);
            // Update after a short delay to allow multiple clicks
            spinning !== null &amp;&amp; window.clearTimeout(spinning);
            spinning = window.setTimeout(function() {
              if ($el.is('.crm-pager a')) {
                page($el.siblings('input[name^=crmPID]').spinner('value'));
              } else {
                changeCount($el.siblings('input.crm-rows-per-page-select').spinner('value'));
              }
            }, 200);
          })
          // Handle sorting, paging and alpha filtering links
          .on('click.crm-pager', 'a.crm-pager-link, #alpha-filter a, th a.sorting, th a.sorting_desc, th a.sorting_asc', function(e) {
            refresh($(this).attr('href'));
            e.preventDefault();
          });
      });
      {/literal}
    &lt;/script&gt;
  </code></pre>
  <p><code>#crm-main-content-wrapper</code> is the main container of All tabs link and tab content. that's why it's html/content replaced by ajax response html.</p>
  <h1><strong>To fix this what I have done:</strong></h1>
  <p>Here is my .tpl file code(after fixed):</p>
  <pre><code>&lt;form class=&quot;Your_Unique_Class_Name&quot;&gt;
  &lt;div class=&quot;view-content&quot;&gt;
    &lt;h3&gt;...&lt;/h3&gt;
    {include file=&quot;CRM/common/pager.tpl&quot; location=&quot;top&quot;}
    {strip}
     &lt;table class=&quot;display&quot;&gt;
      &lt;thead&gt;
      &lt;tr&gt;
          ...
      &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
  
      {foreach from=$rows item=row}
          ...
      {/foreach}
      &lt;/tbody&gt;
      &lt;/table&gt;
      {/strip}
      {include file=&quot;CRM/common/pager.tpl&quot; location=&quot;bottom&quot;}
  &lt;/div&gt;
  {include file=&quot;CRM/common/jsortable.tpl&quot;}
  &lt;/form&gt;
  </code></pre>
  <p>and Code for setting up Pager:</p>
  <pre><code>/**
   * Setting up $_pager for pagination support
   * Used CRM_Utils_Pager &amp; CRM/common/pager.tpl to handle pagination
   */
  public function pager() {
  
  
      $this-&gt;assign( 'form', array( 'formClass' =&gt; 'Your_Unique_Class_Name' ) );
  
  
      // Setting up parameters for Pager that we are gonna create
      $params['status'] = ts('Some Entity %%StatusMessage%%');
      $params['csvString'] = NULL;
      $params['buttonTop'] = 'PagerTopButton';
      $params['buttonBottom'] = 'PagerBottomButton';
      $params['rowCount'] = $this-&gt;get(CRM_Utils_Pager::PAGE_ROWCOUNT);
      if (!$params['rowCount']) {
          $params['rowCount'] = CRM_Utils_Pager::ROWCOUNT;
      }
  
      // Getting all Some Entity by Contact ID. if $_contactId is null then it return value for all Contact.
      $params['total'] = civicrm_api3( 'Entity', 'getcount', array( 'contact_id' =&gt; $this-&gt;_contactId ) );;
  
      // Setup Pager object and assign into template so it can be used by CRM/common/pager.tpl
      $this-&gt;_pager = new CRM_Utils_Pager($params);
      $this-&gt;assign_by_ref('pager', $this-&gt;_pager);
  }
  </code></pre>
  <p>It's taken me long hours to find out this problem solution;</p>
  <p>I think it will help you so that's why sharing with you!</p>
  <p>Thanks</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-31T12:53:10.820Z
Answers.LastActivityDate: 2018-01-31T12:53:10.820Z
Answers.LastEditDate: 2020-06-17T09:00:50.810Z
Answers.UserDisplayName: Riajul
Body: <p>Here is my code of .tpl file: </p>
  
  <pre><code>&lt;div class="view-content"&gt;
  &lt;h3&gt;...&lt;/h3&gt;
  {include file="CRM/common/pager.tpl" location="top"}
  {strip}
      &lt;table class="display"&gt;
          &lt;thead&gt;
          &lt;tr&gt;
              ...
          &lt;/tr&gt;
          &lt;/thead&gt;
          &lt;tbody&gt;
  
          {foreach from=$rows item=row}
              ...
          {/foreach}
          &lt;/tbody&gt;
      &lt;/table&gt;
  {/strip}
  {include file="CRM/common/pager.tpl" location="bottom"}
  &lt;/div&gt;
  {include file="CRM/common/jsortable.tpl"}
  </code></pre>
  
  <p>and Code for setting up Pager:</p>
  
  <pre><code>/**
   * Setting up $_pager for pagination support
   * Used CRM_Utils_Pager &amp; CRM/common/pager.tpl to handle pagination
   */
  public function pager() {
      // Setting up parameters for Pager that we are gonna create
      $params['status'] = ts('Some Entity %%StatusMessage%%');
      $params['csvString'] = NULL;
      $params['buttonTop'] = 'PagerTopButton';
      $params['buttonBottom'] = 'PagerBottomButton';
      $params['rowCount'] = $this-&gt;get(CRM_Utils_Pager::PAGE_ROWCOUNT);
      if (!$params['rowCount']) {
          $params['rowCount'] = CRM_Utils_Pager::ROWCOUNT;
      }
  
      // Getting all Some Entity by Contact ID. if $_contactId is null then it return value for all Contact.
      $params['total'] = civicrm_api3( 'Entity', 'getcount', array( 'contact_id' =&gt; $this-&gt;_contactId ) );;
  
      // Setup Pager object and assign into template so it can be used by CRM/common/pager.tpl
      $this-&gt;_pager = new CRM_Utils_Pager($params);
      $this-&gt;assign_by_ref('pager', $this-&gt;_pager);
  }
  </code></pre>
  
  <p>Thanks.</p>
  
Tags: <contacts>
Title: Contact Tabs links gone away When clicking on Pager Next/Prev/Page Change under My Custom Tab for Contact
ThreadText: # Contact Tabs links gone away When clicking on Pager Next/Prev/Page Change under My Custom Tab for Contact
  
  (Asked by: username_0 on 2018-01-26)
  
  Here is my code of .tpl file:
  
  ```
  <div class="view-content">
  <h3>...</h3>
  {include file="CRM/common/pager.tpl" location="top"}
  {strip}
      <table class="display">
          <thead>
          <tr>
              ...
          </tr>
          </thead>
          <tbody>
  
          {foreach from=$rows item=row}
              ...
          {/foreach}
          </tbody>
      </table>
  {/strip}
  {include file="CRM/common/pager.tpl" location="bottom"}
  </div>
  {include file="CRM/common/jsortable.tpl"}
  
  ```
  
  and Code for setting up Pager:
  
  ```
  /**
   * Setting up $_pager for pagination support
   * Used CRM_Utils_Pager & CRM/common/pager.tpl to handle pagination
   */
  public function pager() {
      // Setting up parameters for Pager that we are gonna create
      $params['status'] = ts('Some Entity %%StatusMessage%%');
      $params['csvString'] = NULL;
      $params['buttonTop'] = 'PagerTopButton';
      $params['buttonBottom'] = 'PagerBottomButton';
      $params['rowCount'] = $this->get(CRM_Utils_Pager::PAGE_ROWCOUNT);
      if (!$params['rowCount']) {
          $params['rowCount'] = CRM_Utils_Pager::ROWCOUNT;
      }
  
      // Getting all Some Entity by Contact ID. if $_contactId is null then it return value for all Contact.
      $params['total'] = civicrm_api3( 'Entity', 'getcount', array( 'contact_id' => $this->_contactId ) );;
  
      // Setup Pager object and assign into template so it can be used by CRM/common/pager.tpl
      $this->_pager = new CRM_Utils_Pager($params);
      $this->assign_by_ref('pager', $this->_pager);
  }
  
  ```
  
  Thanks.
  
  **Tags:** contacts
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-01-31. Score: 1 | Accepted answer
  
  I have found the Problem, Problem was inside pager.tpl
  
  pager.tpl generate some js to handle ajax page loading When pager.tpl location variable != top
  
  That's js look like this without compiled(in pager.tpl):
  
  ```
  {if $location neq 'top'}
    <script type="text/javascript">
      {literal}
      CRM.$(function($) {
        {/literal}
        var
          $form = $({if empty($form.formClass)}'#crm-main-content-wrapper'{else}'form.{$form.formClass}'{/if}),
          numPages = {$pager->_response.numPages},
          currentPage = {$pager->_response.currentPage},
          perPageCount = {$pager->_perPage},
          currentLocation = {$pager->_response.currentLocation|json_encode},
          spinning = null,
          refreshing = false;
        {literal}
        function refresh(url) {
          if (!refreshing) {
            refreshing = true;
            var options = url ? {url: url} : {};
            $form.off('.crm-pager').closest('.crm-ajax-container, #crm-main-content-wrapper').crmSnippet(options).crmSnippet('refresh');
          }
        }
  
        ...
  
        $form
          .on('click.crm-pager', 'a.ui-spinner-button', function(e) {
            var $el = $(this);
            // Update after a short delay to allow multiple clicks
            spinning !== null && window.clearTimeout(spinning);
            spinning = window.setTimeout(function() {
              if ($el.is('.crm-pager a')) {
                page($el.siblings('input[name^=crmPID]').spinner('value'));
              } else {
                changeCount($el.siblings('input.crm-rows-per-page-select').spinner('value'));
              }
            }, 200);
          })
          // Handle sorting, paging and alpha filtering links
          .on('click.crm-pager', 'a.crm-pager-link, #alpha-filter a, th a.sorting, th a.sorting_desc, th a.sorting_asc', function(e) {
            refresh($(this).attr('href'));
            e.preventDefault();
          });
      });
      {/literal}
    </script>
  
  ```
  
  `#crm-main-content-wrapper` is the main container of All tabs link and tab content. that's why it's html/content replaced by ajax response html.
  
  # **To fix this what I have done:**
  
  Here is my .tpl file code(after fixed):
  
  ```
  <form class="Your_Unique_Class_Name">
  <div class="view-content">
    <h3>...</h3>
    {include file="CRM/common/pager.tpl" location="top"}
    {strip}
     <table class="display">
      <thead>
      <tr>
          ...
      </tr>
      </thead>
      <tbody>
  
      {foreach from=$rows item=row}
          ...
      {/foreach}
      </tbody>
      </table>
      {/strip}
      {include file="CRM/common/pager.tpl" location="bottom"}
  </div>
  {include file="CRM/common/jsortable.tpl"}
  </form>
  
  ```
  
  and Code for setting up Pager:
  
  ```
  /**
   * Setting up $_pager for pagination support
   * Used CRM_Utils_Pager & CRM/common/pager.tpl to handle pagination
   */
  public function pager() {
  
      $this->assign( 'form', array( 'formClass' => 'Your_Unique_Class_Name' ) );
  
      // Setting up parameters for Pager that we are gonna create
      $params['status'] = ts('Some Entity %%StatusMessage%%');
      $params['csvString'] = NULL;
      $params['buttonTop'] = 'PagerTopButton';
      $params['buttonBottom'] = 'PagerBottomButton';
      $params['rowCount'] = $this->get(CRM_Utils_Pager::PAGE_ROWCOUNT);
      if (!$params['rowCount']) {
          $params['rowCount'] = CRM_Utils_Pager::ROWCOUNT;
      }
  
      // Getting all Some Entity by Contact ID. if $_contactId is null then it return value for all Contact.
      $params['total'] = civicrm_api3( 'Entity', 'getcount', array( 'contact_id' => $this->_contactId ) );;
  
      // Setup Pager object and assign into template so it can be used by CRM/common/pager.tpl
      $this->_pager = new CRM_Utils_Pager($params);
      $this->assign_by_ref('pager', $this->_pager);
  }
  
  ```
  
  It's taken me long hours to find out this problem solution;
  
  I think it will help you so that's why sharing with you!
  
  Thanks
  
  
  ---
  
  