<script type="text/javascript">  
theight=$( document ).height()-50; 
function setdg(){
	$('#dg').datagrid({
		height:theight,
		toolbar:"#toolbar",
		fitColumns:true,
		singleSelect:true,
		rownumbers:true,		
		pagination:true,
		pageSize:100,
		pageList:[100,200,300,400,500],
		columns:[[  
			{field:'id',title:'id',width:80,hidden:true},
			{field:'tgl',title:'Tanggal',width:100},
			{field:'nama_user',title:'nama_user',width:80},
			{field:'ket',title:'Keterangan',width:200}
		]],
		url: '<?=site_url('log/grid'); ?> '
	});
}

function cari(q){
	$('#dg').datagrid({
		queryParams:{q:q}		
	});
}

function toprint(){
	var opts = $('#dg').datagrid('options');
	q=$("#q").val();
	
	var win = window.open('<?= site_url()?>log/cetak?q='+q+'&page='+opts.pageNumber+'&rows='+opts.pageSize,'Popup','toolbar=no, location=no,status=no,menubar=no,scrollbars=yes,resizable=no');
	win.print();
}

function toxls(){
	var opts = $('#dg').datagrid('options');
	txtcari=$("#txtcari").val();
	openurl('<?=site_url();?>log/excel?q='+q+'&page='+opts.pageNumber+'&rows='+opts.pageSize);
}
</script>	