Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

datatable setup

$('table').dataTable({
	lengthChange: false, //visable show {row} entries
	info : false, // hide showing entries bottom
    pagingType: "first_last_numbers", // showing bottom number
    searching: false, //hide search
    aLengthMenu: [[5, 10, 25, -1], [5, 10, 25, "All"]], // set show {row} entries
	iDisplayLength: 5 // num of rows
});
Comment

using datatable

//html
<table id="table" class="table table-striped table-bordered dt-responsive display nowrap" style="width: 100%!important;">
  <thead class="thead-light"></thead>
</table>

//js
var table = $('#table').DataTable({
    processing: true,
    searching : true,
    paging    : true,
    pageLength: 25,
    ordering  : false,
    data      : data,
    columns: [
        {data: 'id', title: '#'},
        {data: 'name', className: "text-center", title: 'Name'},
        {
          data: function(row){
            return "</a><a class='ui icon blue button' href='/name/view/" + row.id + "'><i class='fas fas fa-search'></i></a>&nbsp;&nbsp;&nbsp;<a class='ui icon blue button' href='/name/" + row.id + "'><i class='fas fa-pencil-alt'></i></a>"
          },
          searchable: false,
          orderable : false,
          className: "text-center",
          title: 'Actions'
        },
    ],
    lengthMenu: [
        [ 25, 50, -1 ],
        [ '25 rows', '50 rows', 'Show all' ]
    ]
  })

jQuery('.dataTable').wrap('<div class="dataTables_scroll" />');

//style
.dataTables_scroll
{
    overflow:auto;
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: push characters to a string javascript 
Javascript :: remove array elements javascript 
Javascript :: font ligature vs code 
Javascript :: check value exist in array javascript 
Javascript :: cdn react 
Javascript :: pyspark json multiline 
Javascript :: windows terminal vai kill all node js port 
Javascript :: javascript strip 
Javascript :: javascript squared 
Javascript :: installe datatable to reactjs project 
Javascript :: javascript get html slider value 
Javascript :: como ler um arquivo json com javascript 
Javascript :: reverse every word 
Javascript :: for loop on a array 
Javascript :: ACCESS IFRAME INNER HTML IN CHROME CONSOLE 
Javascript :: jquery thousand separator 
Javascript :: nested for loops javascript 
Javascript :: is check objet empty 
Javascript :: jquery div element find and remove 
Javascript :: what is ngmodel property binding 
Javascript :: select2 find option by value 
Javascript :: how to set background colour i js inline stylel 
Javascript :: dynamically change css class with javascript 
Javascript :: sotre json on chrome storage 
Javascript :: using map in useeffect 
Javascript :: javascript nth root 
Javascript :: regex link validation 
Javascript :: conditional field validation with Yup 
Javascript :: sticky navbar in react 
Javascript :: css lint 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =