<script type='text/javascript'>
$(document).ready(function(){
	_data = '';
	<?php 
	
	$data = $this->data->data;
	if($this->data->type == 'back'){
		$res = array();
		$in = 50;
		foreach($data as $row){
			$in = $in - 1;
			$res[$in] = $row;
		}
		$data = $res;
	}
	
	$no = $this->data->nom;
	for($rPg = 0; $rPg <= 50; $rPg++){ 
		$i = $data[$rPg];
		if(!empty($i)){
	?>
		_data+= '<tr class="barisManualGrid" id="barisManualGrid_<?php echo $no ?>" _no="<?php echo $no ?>" _pk="<?php echo $i->pk ?>">';
		
		_data+= '<td style="width: 30px">';
		_data+= '<div class="_manualGridTd" style="width: 30px">';
		_data+= '<input type="button" class="_buttonManualGrid" value="" title="Klik Untuk Memilih <?php echo $i->pk ?>" _pk="<?php echo $i->pk ?>">';
		_data+= '</div>';
		_data+= '</td>';
		_data+= '<td style="width: 30px">';
		_data+= '<div class="_manualGridTd" style="width: 30px">';
		_data+= '<input type="text" readonly class="_recManualGrid" _no="<?php echo $no ?>" value="<?php echo $no ?>" id="_nom_<?php echo $no ?>" _pk="<?php echo $i->pk ?>" style="width: 60px">';
		_data+= '</div>';
		_data+= '</td>';
		
		<?php 		
		$basic = new Basic;
		$Code = new Kode;
		$Func = new DisplayFunc;
		$Select = new Select;
		foreach($this->data->set->grid->attr as $row){ 
			$_id = $basic->setIdAttr($row['attr']);
			
			if(strtoupper($row['type']) == strtoupper('date')){
				$i->$_id = date("d/m/Y", strtotime($i->$_id));
				if($i->$_id === '01/01/1970'){
					$i->$_id = '';
				}
			}
			if(strtoupper($row['type']) == strtoupper('numeric')){
				$i->$_id = number_format($i->$_id, (int)$row['dec']);
			}
			
			if(!empty($row['model'])){
				$val = '';
				foreach($row['model'] as $k => $r){
					if(!empty($row['batasModel'])){
						if(!empty($val)){
							$val.= $row['batasModel'];
						}
					}
					$val.= $Code->getLeft($i->$k, $r, ' ');
				}
				$i->$_id = $val;
			}
			if(!empty($row['DisplayFunc'])){
				$funct = $row['DisplayFunc'];
				$i->$_id = $Func->$funct($i->$_id);
			}
			if(!empty($row['select'])){
				$select = $row['select'];
				$select = $Select->$select();
				$i->$_id = $select[$i->$_id];
			}
			$i->$_id = trim($i->$_id);
			if(empty($i->$_id)){
				$i->$_id = '&nbsp;';
			}
		?>
			_data+= '<td>';
			_data+= '<div class="_manualGridTd" style="width: <?php echo $row['width'] ?>px" align="<?php echo $row['align']?>">';
			_data+= '<input type="text" readonly class="_recManualGrid" value="<?php echo $i->$_id ?>"  style="width: <?php echo $row['width'] ?>px" _pk="<?php echo $i->pk ?>">';
			_data+= '</div>';
			_data+= '</td>';
		<?php } ?>
		
		_data+= '</tr>';
	<?php 
			$no++;
		}
	} 
	?>
	<?php if($this->data->type == 'back'){ ?>
		$('#barisManualGrid_<?php echo $this->data->no ?>').before(_data);
		setManualGridFocus('<?php echo ($this->data->no-1) ?>');
		$('#_noFirst').val('<?php echo $this->data->nom ?>');
	<?php }else{ ?>
		$('#barisManualGrid_<?php echo $this->data->no ?>').after(_data);
		setManualGridFocus('<?php echo ($this->data->no+1) ?>');
		$('#_noLast').val('<?php echo ($no-1) ?>');
	<?php } ?>
	
	_cls = $('#_cls').val();
	if(_cls === 'Pcc1'){
		makeBesarFont();
	}
})
</script>