Published on : August 21, 2020
Title | : | Pagination |
Purpose | : | To add the pagination in any list |
Syntax | : | – |
Input Parameter | : | Custom parameters |
Return value | : | List with pagination |
Example | : |
//***main hanler of the module*****//
[templates.add main]
//** Set the variable **//
[template.set email=”govind@loantap.in” /]
//** the following array is contain all the config parameters **//
[template.set_array args]
//** In the atts array you can add your custom parameters, In our example we have used this custom variable in sql query **//
[atts sub_check=”{qs.0}” notification_value={template.email}/]
[after_submit raw]
//** You can use [query debug_dataset=true] to print the query **//
[query]
//** In the following variable you can add the number of record that you want to show in the page **//
[pagesize]10[/pagesize]
[with]
//** Add your query in following sql variable **//
[sql]
select notification_log.ID as data_id,notification_log.*, all_lans.sublan_id from notification_log
left join all_lans on notification_log.object_id=all_lans.lapp_id
where notification_to=[esc.str search.notification_value /]
//** Here we have used the [esc.str search.notification_value /] variable which we add have added in atts array **//
[/sql]
[/with]
[/query]
//** Add the column name in the meta_key(td) and table heading(th) in label **//
[table]
[column new label=’Date’ meta_key=’timestamp’ /]
[column new label=’Notification Type’ meta_key=’notification_type’/]
[column new label=’Subject’ meta_key=’subject’/]
//** you can add html logic in the table using following syntax **//
[column new label=’Message’]
[calc raw]
[if.equal lhs={row.notification_type} rhs=”mail”]
View Body
|
Output | : | List with pagination |
Description | : | We use the pagination to divide the list in the parts |
Following is the example of the pagination
We have added comments in the code to describe the sections
//***main hanler of the module*****//
[templates.add main]
//** Set the variable **//
[template.set email="govind@loantap.in" /]
//** the following array is contain all the config parameters **//
[template.set_array args]
//** In the atts array you can add your custom parameters, In our example we have used this custom variable in sql query **//
[atts sub_check="{qs.0}" notification_value={template.email}/]
[after_submit raw]
//** You can use [query debug_dataset=true] to print the query **//
[query]
//** In the following variable you can add the number of record that you want to show in the page **//
[pagesize]10[/pagesize]
[with]
//** Add your query in following sql variable **//
[sql]
select notification_log.ID as data_id,notification_log.*, all_lans.sublan_id from notification_log
left join all_lans on notification_log.object_id=all_lans.lapp_id
where notification_to=[esc.str search.notification_value /]
//** Here we have used the [esc.str search.notification_value /] variable which we add have added in atts array **//
[/sql]
[/with]
[/query]
//** Add the column name in the meta_key(td) and table heading(th) in label **//
[table]
[column new label='Date' meta_key='timestamp' /]
[column new label='Notification Type' meta_key='notification_type'/]
[column new label='Subject' meta_key='subject'/]
//** you can add html logic in the table using following syntax **//
[column new label='Message']
[calc raw]
[if.equal lhs={row.notification_type} rhs="mail"]
<a href="#" data-toggle="modal" data-target="#msg_[aw2.get row.ID /]">View Body</a>
<div id="msg_[aw2.get row.ID /]" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Email Body</h4>
</div>
<div class="modal-body">
<p>[aw2.get row.message /]</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
[/if.equal]
[if.else]
[aw2.get row.message /]
[/if.else]
[/calc]
[/column]
[column new label='Object Type' meta_key='object_type' /]
[column new label='App ID' meta_key='object_id'/]
[column new label='Sublan ID' meta_key='sublan_id'/]
[column new label='Tracking Status' meta_key='tracking_status'/]
[column new label='Tracking Stage' meta_key='tracking_stage'/]
[/table]
[/after_submit]
//** Following is the buttons to show fast 100 record or full table **//
[handlers]
[fasttable handler=datatable label='Fast(100)' max_count=100][/fasttable]
[datatable][/datatable]
[/handlers]
[/template.set_array]
//*****build page params*****//
[do.@build_page]
//****render html content***//
[html_section.title title="Communication Hostory" /]
[html_section.search args={template.args}/]
[/do.@build_page]
[/templates.add]