'JavaScript&Platform/datatable'에 해당되는 글 3건

  1. 2022.11.24 [datatable] table header 를 html tr 없이 정의 하기
  2. 2020.09.17 [datatable] jquery datatable custom button 만들기
  3. 2018.10.08 [Datatable] Jquery Datatable DOM

 table header 를 html thead tr 사용 하지 않고 정의 하기

<table id="example" class="display" style="width:100%">
    <thead>
    </thead>
</table>

 

<script>

$('#example').DataTable( {
  columns: [
	{"data":"mdate","title":"날짜"},
	{"data":"username","title":"이름"},
	{"data":"tel","title":"연락처"}
  ]
} );

</script>
 

 

Posted by 비니미니파
	"columns" : [
	    	{"data" : "no","defaultContent":""},				
	    	{"data" : "name","defaultContent":""},
	    	{"data" : "user_id","defaultcontent":""},				
	    	{"data" : "",
	    		render: function(data,type,row){
	    			return "<button id='btn_info' type='button' class='btn' onClick='openInfo("+row.user_id+")'>상세정보</button>";
	    		}
	    	}
	],

 

function openInfo(user_id) {

	// Table 에서 받은 user_id 출력
	console.log(user_id);
    
}
Posted by 비니미니파
  • l - length changing input control
  • f - filtering input
  • t - The table!
  • i - Table information summary
  • p - pagination control
  • r - processing display element

 

https://datatables.net/reference/option/dom

 

정리는 나중에

Posted by 비니미니파