MPDF getting value from previous page with autopagebreak - laravel

I have data with 200 records and each page must have title of that data's category with total sum of data from previous page but when auto page break trigger to new page I just want $total value from the first page using in other page
for example
$total =0;
<table>
<thead>
<tr>
<th>Category 1</th>
<th>total = {$total}</th>
</tr>
</thead>
<tbody>
foreach($data in $list):
<tr>
<td>$data->name;</td>
<td>$data->total;</td>
</tr>
$total+=$data->total
endforeach;
</tbody>
</table>
in this table when auto page break trigger and title of the total value in new page become 0
how to use global value for every pages?
thank you

Related

Circumvent Boostrap-Table from rendering 100+ rows slowly

I'm rendering a list of state objects (with Spring and Thymeleaf) on my view page:
<table id="state-table" data-toggle="table" data-pagination="true" data-pagination-v-align="top" data-search="true">
<thead>
<tr>
<th data-sortable="true">ID</th>
<th data-sortable="true">Descrizione</th>
<th>Azioni</th>
</tr>
</thead>
<tbody>
<tr th:each="s : ${state}">
<td><span th:text="${s.id}"></span></td>
<td><span th:text="${s.descrizione}"></span></td>
</tr>
</tbody>
</table>
The table contains about 150 elements, but when the page is rendering I see for less than a second an ugly page (is the plugin trying to paginate the result) and I would like to avoid it.
I have already tried adding a timeout as workaround:
$(function() {
$("#state-table").bootstrapTable("showLoading");
setTimeout(function() {
$("#state-table").bootstrapTable("hideLoading");
}, 1000);
});
but with this code, when the page renders, I see a strange html page at beginning, then I see the loading message, and finally the table with all elements loaded.
I think I have to intervene before (or while) the table is created but I don't know how. What would I need to do so that the table is rendered correctly without the user noticing the ugly "un-bootstraped" table?
Try To use Pagination instead of showing all your entries.
Hope it help you : https://www.baeldung.com/spring-thymeleaf-pagination

Html Agility Pack loop through Specific Row

I have a table like this
<table>
<thead>
<tr>
<th>Name</th>
<th>Department</th>
<th>Gender</th>
</tr>
</thead>
<tbody>
<tr id="data1">
</tr>
<tr>
</tr>
</tbody>
And I want to use Html Agility Pack to parse its specific row i.e i want to display row next to row which has id=data1
below is code I am trying ...
//Selecting Document Node....
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(data);
//Selecting Specific Node...
var tableNodes = doc.DocumentNode.SelectNodes("//table");
Your xpath should be like this:
//table/tbody/tr[#id='data1']/following-sibling::tr

PDF Layout with MigraDoc

I am trying to achieve following matrix kind of layout:
TABLE1,1 TABLE1,2
CHART2,1 TABLE2,2
TABLE3 --> occupies whole row
CHART4 --> ocupies whole row
CHART5,1 CHART5,2
................. List goes on...
These components may span over multiple pages. What is the best way to have them side by side and still be able to view them in MigraDoc.
CHART5,1 could be a combination of 4 charts in one cell.
In HTML view I can use following analogy:
<TABLE>
<TR>
<TD>TABLE1,1</TD> <TD>TABLE1,2 </TD>
</TR>
<TR>
<TD>CHART2,1</TD> <TD>TABLE2,2 </TD>
</TR>
<TR>
<TD>TABLE3</TD colspan =2>
</TR>
<TR>
<TD>CHART4</TD colspan =2>
</TR>
<TR>
<TD>CHART5,1</TD> <TD>CHART5,2 </TD>
</TR>
</TABLE>
The MigraDoc equivalent for colspan=2 is MergeRight=1. This is a property of the Cell class.

Simple laravel 5 pagination links

In my controller I'm displaying records in a table in my View.
Controller:
$promotion = Promotions::paginate(5);
View:
<tr>
<th>Order</th>
<th>Infomation</th>
<th>Date</th>
<th>Cost</th>
<th>From</th>
</tr>
</thead>
<tbody align="center">
<?php $i = 0;?>
#foreach ( $promotion as $promo)
<?php $i++;?>
<tr>
<td data-title="Order">{{$i}}</td>
<td data-title="Infomation">{{$promo['name']}}</td>
<td data-title="Date">29/10/57</td>
<td data-title="Cost">1.99$</td>
<td data-title="From">K-Bank</td>
</tr>
#endforeach
</tbody>
It works properly when I locate manually to exampleurl/mypage?page=2
All seems well. However, I wanted to create two text buttons to go back and fourth between pages.
How can I set these to navigate the pagination back and fourth:
Previous
Next
EDIT: I don't understand why I'm getting downvoted for this question. No where can I find a tutorial on how to split the back and fourth buttons. How professional can your website be if you're restricted to placing the page links to one spot on the page? seriously...
In Laravel 5 there is a single configuration option for Eloquent models to generate pagination. So, you can use the method:
<?php echo $promotion->render(); ?>
If you want an option only with Previous and Next buttons, you need to use
$promotion = Promotions::simplePaginate(5);
Instead of
$promotion = Promotions::paginate(5);

html table max row and ajax navigation

I have a PHP page that returns an HTML table like this:
<table>
<tr>
<td>First Row data</td><td>Second Row data</td><td>Third Row data</td>
</tr>
<tr>
<td>First Row data</td><td>Second Row data</td><td>Third Row data</td>
</tr>
<tr>
<td>First Row data</td><td>Second Row data</td><td>Third Row data</td>
</tr>
<tr>
<td>etc...</td>
</tr>
</table>
What I want to do is to add an ajax numerical pagination system (1 2 ... 6) that allows we to fix a max 3 rows to display and reaching the others with the navigation.
Do you know where can I find a ready script that can help to solve this problem?
Is this about what your looking for?
http://www.dynamicdrive.com/dynamicindex17/ajaxpaginate/index.htm

Resources