DataTable : 항목 표시 드롭 다운을 숨기고 검색 상자는 유지
항목 표시 드롭 다운을 숨기고 검색 상자를 DataTable에 유지할 수 있습니까? 검색 상자와 함께 맨 아래에 페이지 매김이있는 10 행을 항상 표시하고 싶지만 항목 표시 드롭 다운을 표시하고 싶지 않습니다.
이 링크에서 직접 자세한 정보를 찾을 수 있습니다 : http://datatables.net/examples/basic_init/filter_only.html
$(document).ready(function() {
$('#example').dataTable({
"bPaginate": false,
"bLengthChange": false,
"bFilter": true,
"bInfo": false,
"bAutoWidth": false });
});
희망이 도움이됩니다!
편집 : 게으른 경우 "bLengthChange": false, 변경해야합니다. :)
Datatable> 1.1.0을 사용하는 경우 lengthChange
옵션은 다음 과 같습니다.
$('#example').dataTable( {
"lengthChange": false
});
이 게시물에 대한 핵심 답변 "bLengthChange": false,
은 항목 드롭 다운을 숨길 것입니다
"searching": false, // Search Box will Be Disabled
"ordering": false, // Ordering (Sorting on Each Column)will Be Disabled
"info": true, // Will show "1 to n of n entries" Text at bottom
"lengthChange": false // Will Disabled Record number per page
나는 그것을 그렇게 해결합니다. 부트 스트랩 사용 4
$(document).ready(function () {
$('#table').DataTable({
"searching": false,
"paging": false,
"info": false
});
});
cdn js :
- https://code.jquery.com/jquery-3.3.1.min.js
- https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.bundle.min.js
- https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js
- https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js
cdn CSS :
- https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css
- https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css
DataTables <= 1.9의 경우 @perpo 의 답변
$('#example').dataTable({
"bLengthChange": false
});
잘 작동하지만 1.10 이상에서는 다음을 시도하십시오.
$('#example').dataTable({
"dom": 'ftipr'
});
여기서 l
"길이 변경 입력 제어"를 생략했습니다 .
sDom : "Tfrtip"또는 콜백을 통해 :
"fnHeaderCallback": function(){
$('#YOURTABLENAME-table_length').hide();
}
"항목 표시"레이블을 비활성화하려면 코드 dom : 'Bfrtip'을 추가하거나 "bInfo"를 추가 할 수 있습니다. false
$('#example').DataTable({
dom: 'Bfrtip'
})
"항목 표시"를 숨기지 만 여전히 페이지 매김이 있습니다. 아래 코드를 사용했는데 효과가있었습니다.
"bPaginate": true,
"bLengthChange": false,
"bFilter": true,
"bInfo": false,
"bAutoWidth": false
이 옵션을 추가하십시오 :
"bInfo": false
You can try this also.
simply hide it from CSS by using,
.dataTables_length {
display: none;
}
Both will work.
Just write :
$(document).ready( function () {
$('#example').dataTable( {
"lengthChange": false
} );
} );
To disable the "Show Entries" label, use "bInfo", example: "bFilter" is the search component, but are active by default.
$(document).ready( function () {
$('#example').dataTable( {
"bInfo": false
} );
} );
Enable or disable the table information display. This shows information about the data that is currently visible on the page, including information about filtered data if that action is being performed.
'programing tip' 카테고리의 다른 글
PHP7 : ext-dom 문제 설치 (0) | 2020.07.26 |
---|---|
안드로이드 디렉토리에 파일을 나열하는 방법? (0) | 2020.07.26 |
유효한 IPv6 주소와 일치하는 정규식 (0) | 2020.07.26 |
Vim에서 f 및 t 명령은 무엇을합니까? (0) | 2020.07.26 |
DIV 대신 테이블 (0) | 2020.07.26 |