<script type="text/javascript">
$(function(){	
	
window.parent.$('#content_title').panel('setTitle', '<?=$this->title?>');
setdg();
$('.validatebox-text').bind('blur', function(){
	$(this).validatebox('enableValidation').validatebox('validate');
});
$('#TpBarang').combobox({  
	width:150,
	mode:'remote', 
	url:'<?=site_url('mtgrup/gridJnsBarang'); ?>',  
	valueField:'KdJnsBarang',  
	textField:'UrJnsBarang',
	pagination:true  
});
$('#TpBarang2').combobox({  
	width:150,
	mode:'remote', 
	url:'<?=site_url('mtgrup/gridJnsBarang2'); ?>',  
	valueField:'KdJnsBarang',  
	textField:'UrJnsBarang',
	pagination:true  
});
$('#MatGroup').combobox({  
	width:150,
	mode:'remote', 
	url:'<?=site_url('mtgrup/gridAll'); ?>',  
	valueField:'matgroup_code',  
	textField:'matgroup_name',
	pagination:true  
});
$('#Sat').combobox({  
	width:100,
	mode:'remote', 
	url:'<?=site_url('uom/gridAll'); ?>',  
	valueField:'KdSat',  
	textField:'UrSat',
	pagination:true   
});
	
$('#btnTbh').click(function(){
	tambah();
});

// $('#btnTbh').click(function() {
//     // Show loading indicator using EasyUI's messager
//     $.messager.progress({
//         title: 'Processing',   // Title of the loading dialog
//         msg: 'Please wait...', // Message displayed in the loading dialog
//     });

//     $.ajax({
//         url: 'https://'+window.location.hostname+':8080/processCSVMstItem',
//         type: 'GET',  // Assuming it's a GET request, you can change it to POST if needed
//         success: function(response) {
//             $('#dg_hdr').datagrid('reload');
//             alert("Success!");

//             // Hide the loading indicator after success
//             $.messager.progress('close');
//         },
//         error: function(xhr, status, error) {
//             $('#dg_hdr').datagrid('reload');
//             alert("Error occurred!");

//             // Hide the loading indicator after error
//             $.messager.progress('close');
//         }
//     });
// });

$('#btnUbh').click(function(){	
	ubah();
});
$('#btnHps').click(function(){
	hapus();
});
$('#btnSim').click(function(){
	simpan();
});
$('#btnPrint').click(function(){
	toprint();
});
$('#btnExcel').click(function(){
	toxls();
});
$('#btnSubmit').click(function(){
	simpan();
});
$('#btnReset').click(function(){
	$('#fm').form('clear');
});
$('#q').searchbox({
	width:200,
	searcher:function(value,name){  
		///alert(value + "," + name)  
		cari(value);
	},
	prompt:'Cari Kode & Nama'  
});  
});//Akhir Document Ready
</script>