如何使用javascript根据特定的表数据从客户端对表数据进行排序

时间:2018-04-02 19:30:32

标签: javascript php laravel sorting client-side-scripting

这是我在laravel中编码的表格数据。我只想按发布日期对数据进行排序。我必须从客户端执行此操作,并且由于某种原因无法从控制器执行此操作。我想有一些javascript的建议或演示代码。提前致谢。

 <table class="table">
   <thead>
      <tr>
        <th>No</th>
        <th>PR ID</th>
        <th>PR Type</th>
        <th>Issue Date</th>
        <th>End Date</th>
      </tr>
   </thead>
   <tbody>
      <?php 
         $j=1;
         $checker = 1;
         $checker2 = 0;
         if($current > 1){
            $checker = $current*2;
            $checker2 = ($current*2)+50;
         }else if( $quot_count = 1 && $current = 1){
            $checker2 = 2;
         }else if( $quot_count = 2 && $current = 1){
            $checker2 = 50;
         }else{
            $checker2 = ($current*2)+2;
         }?>
         @for($i= $checker; $i < $checker+50; $i++ )
            @if(isset($quotations->$i->qr_details->pr_id))
         <tr>
            <td>{{ $j++ }}</td>
            <td class="prId" id=""><a style="cursor: pointer;" class="pr-modal" rel="{{$i}}" data-toggle="modal" data-target="#myModal{{$i}}">{{ $quotations->$i->qr_details->pr_id }}</a></td>
            <td>{{ $quotations->$i->qr_details->pr_type }}</td>
            <td>{{ $quotations->$i->qr_dates->start_date }}</td>
            <td>{{ $quotations->$i->qr_dates->end_date }}</td>
         </tr>
         @endif
         @endfor
    </tbody>
 </table>

0 个答案:

没有答案