Unable to print multiple rows, only printing first set of data

Unable to print multiple rows, only printing first set of data

skyeskye Posts: 1Questions: 1Answers: 0

Good day! I am using datatables with Laravel. Whenever i use the export to excel/pdf and print functionality, it only shows the first set of data.
This is the table view:

This is the printing output (only showing the first set of data):

This is my blade view code:

                          <table class="table table-bordered table-hover" id="example2">
                                 <thead>
                                    <tr>
                                        <th style="text-align:center;" ><strong>ID</strong></th>
                                        <th style="text-align:center;" ><strong>NAME</strong></th>
                                        <th style="text-align:center;"><strong>GRADE</strong></th>
                                        <th style="text-align:center;"><strong>STEP</strong></th>
                                        <th style="text-align:center;" ><strong>MONTHLY SALARY</strong></th>
                                        <th style="text-align:center;"><strong>P.E.R.A</strong></th>
                                        <th style="text-align:center;" ><strong>TOTAL DEDUCTION</strong></th>
                                        <th style="text-align:center;" ><strong>NET AMOUNT</strong></th>
                                        <th style="text-align:center;" ><strong>ACCOUNT NUMBER</strong></th>
                                  

                                    </tr>
                                </thead>
                                @foreach ($payroll as $row)
                                <tbody>
                                    <tr>
                                        <td style="text-align:center;"><strong>{{$row['empno']}}</strong></td>
                                        <td style="text-align:center;"><strong>{{$row['fname']}}</strong></td>
                                        <td style="text-align:center;"><strong>{{$row['GRADE']}}</strong></td>
                                        <td style="text-align:center;"><strong>{{$row['STEP']}}</strong></td>
                                        <td style="text-align:center;"><strong>@money($row['basic'])</strong></td>
                                        <td style="text-align:center;"><strong>{{$row['PERA']}}</strong></td>
                                        <td style="text-align:center;"><strong>@money($row['basic'] - $row['TAKEHOME'])</strong></td>
                                        <td style="text-align:center;"><strong>@money($row['TAKEHOME'])</strong></td>
                                        <td style="text-align:center;"><strong>{{$row['ACCOUNT']}}</strong></td>
                                    </tr>
                                    @foreach($row->deduction as $row1)
                                        @foreach($row->dedName as $row2)
                                            @if($row2['dedCode'] == $row1['dedCode'])
                                        <tr>
                                            <td style="text-align:center;">{{$row1['dedCode']}}</td>
                                            <td style="text-align:center;">{{$row2['dedName']}}</td><td></td>
                                            <td style="text-align:center;"></td>
                                            <td style="text-align:center;">@money($row1['dedAmount'])</td>
                                            <td style="text-align:center;"></td>
                                            <td style="text-align:center;"></td>
                                            <td style="text-align:center;"></td>
                                            <td style="text-align:center;"></td>
                                        </tr> 
                                            @endif
                                        @endforeach
                                    @endforeach
                                </tbody>
                            @endforeach
                           </table>

Any ideas or workaround. Any help will be greatly appreciated. Thank you very much.

Answers

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    Are you using server-side processing, i.e. serverSide? If so, then yep, that is expected, please see this thread for more info. If not, we're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

Sign In or Register to comment.