当前位置:网站首页>JS - DataTables control on the number of displays per page
JS - DataTables control on the number of displays per page
2022-07-26 09:06:00 【Angry devil】
Brief introduction
ataTable Is a very useful form management plug-in , In use , We just need to give the data to datatable,datatable Can automatically give us the management form , Its functions include paging 、 Sort 、 Search for , wait .
This front-end plug-in has another feature , The display field is controlled by the backend , Data request , Also in the way of interface .
therefore , New contacts , It may not be clear , Each page shows where the entries are controlled , I took a detour at the beginning , Will now " Control of the number of displays per page ", Summarized below .
The point is
iDisplayLength:pageShowNums // Number of displays per page
Code example
JS Code operation location :
let options = {
serverSide: true,
paging: true,
searching: false,
ordering: false,
iDisplayLength:100, // 【1】
ajax: {
url: "/user-manages" // 【2】
},
columns: [
@foreach ($columns as $column)
{data: "{
{ $column->name }}"} @if (!$loop->last) , @endif
@endforeach
], // 【3】
rowCallback: function(row, data) {
@can('manage diantai user')
let actions = '<a href="/user-manages/' + data.id + '/edit" class="btn btn-primary"> edit </a>'
actions += '<button class="btn btn-sm btn-delete" data-id="' + data.id + '"
data-toggle="modal" data-target="#modal_confirm"> Delete </button>';
$('td:eq({
{ count($columns) }})', row).html(actions)
$('#count_num').text(data.count);
@endcan
}
}
Explanation of notes
【1】: This is to control the setting of the number of items displayed in the list , These are all in js End control
【2】: Request data interface , namely , The data of your current page is requested from this interface
【3】: This part , It is responsible for traversing and displaying the table header information data at the back end
边栏推荐
猜你喜欢
[leetcode database 1050] actors and directors who have cooperated at least three times (simple question)
2022化工自动化控制仪表操作证考试题模拟考试平台操作
2022年上海市安全员C证考试试题及模拟考试
Announcement | FISCO bcos v3.0-rc4 is released, and the new Max version can support massive transactions on the chain
Database operation topic 1
[database] gbase 8A MPP cluster v95 installation and uninstall
李沐d2l(六)---模型选择
布隆过滤器
The lessons of 2000. Web3 = the third industrial revolution?
187. Repeated DNA sequence
随机推荐
公告 | FISCO BCOS v3.0-rc4发布,新增Max版,可支撑海量交易上链
Form form
Laravel框架日志文件存放在哪里?怎么用?
NPM add source and switch source
Codeworks DP collection
ext4文件系统打开了DIR_NLINK特性后,link_count超过65000的后使用link_count=1来表示数量不可知
李沐d2l(四)---Softmax回归
【无标题】
(2006,Mysql Server has gone away)问题处理
Pytoch realizes logistic regression
Introduction to excellent verilog/fpga open source project (30) - brute force MD5
Summary of common activation functions for deep learning
2022化工自动化控制仪表操作证考试题模拟考试平台操作
[leetcode database 1050] actors and directors who have cooperated at least three times (simple question)
本地缓存
JDBC database connection pool (Druid Technology)
redis原理和使用-基本特性
Set of pl/sql -2
分布式跟踪系统选型与实践
mysql函数