Note that there are some explanatory texts on larger screens.

plurals
  1. PODiv strangely shown at the top with Tablesorter
    primarykey
    data
    text
    <p>I'm using <a href="http://tablesorter.com/docs/" rel="nofollow noreferrer">http://tablesorter.com/docs/</a> to try to sort a table. It works with a cosmetic issue that is not so much disturbing. The "zebra" doesn't activate until you really try to order the table. Isn't annoying at all but I couldn't find why this happens.</p> <p>My really problem is that I'm trying to use also the pager plugin. The pager div appears at the top of the page. It may be caused (both problems) because I have the table inside a prior hidden tab the first time it appears. The content is loaded from a PHP file via AJAX and, when loaded, depending on the data, I could active tabs and tablesorter (or not). If I do that, I do with this lines of code:</p> <pre><code>(".tab_content").hide(); $("ul.tabs li:first").addClass("active").show(); $(".tab_content:first").show(); $("#calls").tablesorter({widthFixed: true, widgets: ['zebra']}).tablesorterPager({container: $("#pager")}); </code></pre> <p>The "pager" div is inside the tab, just below the target table.</p> <p>As @mu is to shoort stated pager needs to know where the table is.</p> <p>Tabs are loaded with </p> <pre><code>&lt;ul class="tabs"&gt; &lt;li&gt;&lt;a href="#cont-standard-report"&gt;Standard&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#cont-extensions-report"&gt;Extensions&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a id="calls" href="#cont-calling-report"&gt;Callings&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>So, I tried with the proposed function but it even doesn't call it when clicking the tab.</p> <pre><code>$("#cont-calling-report").one('click', function() { alert ("Test"); $("#calls").tablesorter({widthFixed: true, widgets: ['zebra']}) .tablesorterPager({container: $("#pager")}); }); </code></pre> <p>This is what happens. No click needed.</p> <p><img src="https://i.stack.imgur.com/urkAj.jpg" alt="http://imgur.com/CJnYX"></p> <p>Managed to solve with this</p> <p>Managed to solve it with this:</p> <pre><code>if (activeTab == '#cont-callings-report' &amp;&amp; !tablesorter){ $("#calls").tablesorter({widthFixed: true, widgets: ['zebra']}).tablesorterPager({container: $("#pager")}); tablesorter = 1; } </code></pre> <p>Inside the tab function.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload