jquery - Is it possible to use php to write in the tables and already use datatable to make tables optimize? -


i have more 1 table in 1 view , use jquery make them hide , show.i have array $works contains arrays of works.each array contains data rows of each table. use datatable optimize tables using pagination , able search.

but seems datatables doesn't know blade language , php. set datatable show me in each page 10 row of table.but when table has more 10 rows shows me rows , shows:

showing 1 1 of 1 entries 

the above expression.

<div class="col-md-offset-1 col-md-7"> <?php $i = 0 ?> @foreach($works $work)         <!--<div class="panel navbar-inverse">             <div class="panel-heading panel-amir">                 <p href="#">current works</p>             </div>--> <?php $i+=1; ?> <div id="{{$dep->id}}" class="panel-body testimonial" data-index="{{$i}}">      <table cellpadding="0" cellspacing="0" border="0" class="table table-hover table mytable" id="example" data-index="{{$i}}">         <thead style="text-align: center">         <th style="text-align: center">user works</th>         <th style="text-align: center">title</th>         <th style="text-align: center">due date</th>         <th style="text-align: center">description</th>         </thead>          @foreach($work $var)         <tbody>          <tr>             <td class="col-md-2">                 <img class="img-circle img-responsive" src="{{ url::to('/') }}/images/amir.png">             </td>             <td class="col-md-2">                 alaki             </td>             <td class="col-md-2">                 alaki             </td>             <td class="col-md-6">                 alaki             </td>         </tr>          </tbody>         @endforeach     </table> </div> @endforeach 

enter image description here

is there idea should design page correctly????

datatables supports one <tbody> section @ time. have

@foreach($work $var)    <tbody>      ....    </tbody> @endforeach 

causing multiple <tbody>'s, thats why showing 1 1 of 1 entries. iterate on rows instead :

<tbody>   @foreach($work $var)     <tr>       <td class="col-md-2">     ...     </tr>   @endforeach </tbody> 

by doing that, sure correct number of rows in info-section, , table paginate expected.


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -