<div style="height:40px;">
	<button id="btngetdatasupplierfrommodul" >Get Data Modul</button>
</div>
 <table id="tbluploadmodulsupplier"></table> <div id="ptbluploadmodulsupplier"></div>   
<script type="text/javascript">
    
    $(document).ready(function(){
		$("#btngetdatasupplierfrommodul").button().click(function(){
		
			$("#dlggetsupfrommodul").dialog( "destroy" );
			$(".dlggetsupfrommodulcl").remove();
			$("body").append('<div id="dlggetsupfrommodul" title="Warning" class="dlggetsupfrommodulcl"><p>Apakah anda akan mengambil data dari modul?!?</p><br /></div>');
			$("#dlggetsupfrommodul").dialog({
				height: 200,
				width: 250,
				modal: true,
				hide: 'Slide',
				autoOpen: 'false',
				buttons: {
					"CONFIRM": function() {
					$.ajax({
						url : "<?php echo base_url().'settings/ct_supplier/get_supplier_frommodul'; ?>",
						type : 'POST',
						dataType: 'json',
						data : {'a':'a'},
						success: function(msg){
							if (msg.sts == '00'){
								alert(msg.desc);
								$("#dlggetsupfrommodul").dialog("close");
								$('#dlggetsupfrommodul').dialog("destroy"); 
								$(".dlggetsupfrommodulcl").remove(); 
								$('#tbluploadmodulsupplier').trigger('reloadGrid');
							} else { 
								alert(msg.sts+' '+msg.desc); 
								$("#dlggetsupfrommodul").dialog("close");
								$('#dlggetsupfrommodul').dialog("destroy"); 
								$(".dlggetsupfrommodulcl").remove(); 

							}
						}
					});
				},
					"CANCEL": function() {
						$( "#dlggetsupfrommodul" ).dialog( "close" );

					}
				},
				close : function(){
					$('#dlggetsupfrommodul').dialog("destroy"); 
					$(".dlggetsupfrommodulcl").remove(); 
					$("body").append('<div id="dlggetsupfrommodul" title="Warning" class="dlggetsupfrommodulcl"><p>Apakah anda akan mengambil data dari modul?!?</p><br /></div>');     
					
				},
				open: function(){
					$("body").unblock();
					
				}
			});
		
		
		});
		jQuery("#tbluploadmodulsupplier").jqGrid({
			url:'<?php echo base_url().'settings/ct_supplier/data_modulsupplier'; ?>',
			mtype : "post",
			postData:{'q':'1'},
			datatype: "json",
			colNames:['Nama Supplier', 'Alamat','Negara'],
			colModel:[
				{name:'PasokNama',index:'PasokNama', width:321},
				{name:'PasokAlmt',index:'PasokAlmt', width:349},
				{name:'PasokNeg',index:'PasokNeg', width:106}
				],
			rowNum:10,
			rowList:[10,20,30],
			pager: '#ptbluploadmodulsupplier',
			sortname: 'PasokNama',
			viewrecords: true,
			sortorder: "asc",
			width: 800,
			height:220,
			jsonReader: { repeatitems : false },
			caption:"Supplier from Modul",
			rownumbers: true,
			shrinkToFit: false,
			afterInsertRow: function(){
				
				
			},			
			gridComplete: function(){
			
			},
		}); 
		
		jQuery("#tbluploadmodulsupplier").jqGrid('navGrid','#ptbluploadmodulsupplier',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		jQuery("#tbluploadmodulsupplier").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : false, defaultSearch: 'cn', ignoreCase: true});
		
	});
		  	
</script>



	
	