반응형

https://datatables.net/plug-ins/pagination/input
Navigation with text input
Navigation with text input Shows an input element into which the user can type a page number Sometimes for quick navigation, it can be useful to allow an end user to enter which page they wish to jump to manually. This paging control uses a text input box
datatables.net
페이지네이션으로 페이지별 쪼갰는데, 해당 기본 옵션에선 첫장과 끝장빼곤 한개씩 이동이라...
실무자가 불편하다고해서 바꾸기로 했는데, 원하는 옵션이 없어
그냥 input으로 이동하고 싶은 페이지로 바로 이동하도록 하는 옵션으로 변경.
$(document).ready(function() {
$('#example').dataTable( {
pagingType: "input",
pageLength: 10, // 기본 출력 갯수
language: {
oPaginate: {
sNext: '<i class="fa fa-forward"></i>',
sPrevious: '<i class="fa fa-backward"></i>',
sFirst: '<i class="fa fa-step-backward"></i>',
sLast: '<i class="fa fa-step-forward"></i>'
}
},
} );
} );
CDN은 편리하지만, CDN이 차단된 나라가 있을 수 있어(Ex: 중국...)
JS파일을 만들어 적용시켜버렸다.
https://cdn.datatables.net/plug-ins/1.13.4/pagination/input.js
해당 사이트로 접속해서 Ctrl+s 눌러 저장후 서버 자체에서 호출하는 방식으로 해결.
정상 작동되고 더 편리해졌다.
728x90
'취업 > Datatable' 카테고리의 다른 글
[Datatable] datatable 페이지네이션 처리 (0) | 2023.04.14 |
---|---|
[Datatable] rowspan is not working 동적 tr 생성 및 rowspan 적용하기. (0) | 2022.09.26 |
[JS]DATATABLE AJAX를 통한 새로운 값 변경하기. (0) | 2022.08.23 |
[PHP] DATATABLE AJAX 통신하기2. (0) | 2021.11.03 |
[php]Datatable ajax 통신하기. (0) | 2021.11.02 |