This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

[Solved] Problem with jQuery Tablesorter pager addon

Forum to discuss ExtJS and other JS plugins

[Solved] Problem with jQuery Tablesorter pager addon

by eglite » Thu Dec 09, 2010 4:59 am

Hello!

I'm using Tablesorter jQuery plugin from http://tablesorter.com/docs/index.html to sort data in Symfonys generated table.
Everything works well except when i add tablesorter pager addon, tablesorter stops working and Firebug throws error and points to the ptablesorter pager code line:
Code: Select all
syntax error
[Break On This Error] .tablesorterPager( {


In layout.php I have added:
Code: Select all
   <?php use_javascript('jquery-latest.js') ?>
   <?php use_javascript('jquery.tablesorter.js') ?>   
   <?php use_javascript('addons/pager/jquery.tablesorter.pager.js') ?>
   <?php include_javascripts() ?>   


And indexSuccess.php looks like this:
Code: Select all
$(document).ready(function()
    {
        $("#myTable")
      .tablesorter( {   
      //  sortList:[[0,1]]
      });
      .tablesorterPager( {
        container: $("#pager")
      });
    }
);

   <table id="myTable">
   <thead>
   <tr>
     <th>Id</th>
     <th>Pasūtījuma Nr.</th>
     <th>Pasūtītājs</th>
     <th>Pasūtījuma datums</th>
     <th>Sektors</th>
     <th>Paraugu piegādes datums</th>
     </tr>
   </thead>
   
   <tbody>
      <?php foreach ( $testorders as $testorder): ?>
         <tr>
            <td> <?php echo $testorder->getId(); ?> </td>
              <td class="name">
            <a href="<?php echo url_for('testorder/show?id='.$testorder->getId()) ?>">
               <?php echo $testorder->getOrderNo() ?>
            </a>
            </td>
            <td class="note">
              <?php if (!$testorder->getPasJurpId() == null): ?>
                <?php echo $testorder->getJurp()->getName(). ' '.$testorder->getJurp()->getJurform()->getName() ?>
               <?php elseif (!$testorder->getPasFizpId() == null): echo $testorder->getFizps()->getName().' '.$testorder->getFizps()->getSurname() ?>
               <?php else: echo 'Nav noradīts' ?>
              <?php endif ?>
            </td>
            <td class="date_time"><?php echo $testorder->getOrderDate() ?></td>
            <td class="name"><?php echo $testorder->getSektors() ?></td>
            <td class="date_time"><?php echo $testorder->getParauguPiegDat() ?></td>
         </tr>
      <?php endforeach; ?>
   </tbody>
   </table>


If i comment pager code lines, tablesorter works, but when i remove comments it stops working.
Any idea what could be wrong?

Thanks!
eglite
Junior Member
 
Posts: 9
Joined: Mon Nov 22, 2010 4:44 pm

Re: Problem with jQuery Tablesorter pager addon

by eglite » Thu Dec 09, 2010 7:58 am

Everything works fine after I changed indexSuccess.php files script to:
Code: Select all
<script type="text/javascript">
   $(document).ready(function() {
      $("table")
      .tablesorter({widthFixed: true, widgets: ['zebra']})
      .tablesorterPager({container: $("#pager")});
   });
</script>
eglite
Junior Member
 
Posts: 9
Joined: Mon Nov 22, 2010 4:44 pm