Yii Framework Forum: [ASK]Jquery Easy UI (jeasyui) di Yii - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[ASK]Jquery Easy UI (jeasyui) di Yii jQuery, Yii, PHP, javascript Rate Topic: -----

#1 User is offline   A Ginanjar 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 08-May 12

Posted 08 May 2012 - 05:50 AM

Halo Yii-ers ..

Thread pertamax nih :D
oia saya mau tanya soal grid-grid :blink:
awalnya ane liat-liat disini.. http : //www*jeasyui*com/tutorial/datagrid/datagrid22_demo.html
source code / dokumentasi dari sononya kurang lebih seperti ini : http : //www*jeasyui*com/tutorial/datagrid/datagrid22.php

trus ane rubah-rubah dikit disesuaikan dengan aplikasi di ane. Masih menggunakan PHP dan Query (tanpa Yii)
dan bisa jalan..

kemudian ane coba masukkan ke Yii..
ane bikin fungsi di controller dengan nama getData ama getDetail..

controller >>
public function actionGetdata(){
		$result = array();
	
		$rs = Users::model()->findAll();
	
		$items = array();
		foreach($rs as $row)
		{
			
			array_push($items, $row->getAttributes(array('id','username', 'fname', 'lname'))); 
		}
		echo json_encode($items);
	}
public function actionGetdetail(){
		$itemid = $_GET['owner'];
		
		$rs = Units::model()->findAllByAttributes(array('owner'=>$itemid));
		$items = array();
		foreach($rs as $row)
		{
			$items[] = $row->getAttributes(array('name', 'imei', 'tipe', 'no_sim_card', 'status_gprs', 'gmt'));
		}
		echo json_encode($items);
	}

oia ane juga udah set access Rule nya untuk getData dan getDetail.

dan untuk view nya kurang lebih seperti ini
View >>
<?php 
$url = Yii::app()->baseUrl;

$cs = Yii::app()->getClientScript();
$cs->registerScriptFile(bu().'/js/jquery-easyui-1.2.6/jquery-1.7.2.min.js');
$cs->registerScriptFile($url.'/js/data-grid/jquery.easyui.min.js');
$cs->registerScriptFile($url.'/js/data-grid/datagrid-detailview.js');

	?>
	
	<link rel="stylesheet" type="text/css" href="<?php echo $url.'/css/demo.css'?>">
	<link rel="stylesheet" type="text/css" href="<?php echo $url.'/css/easyui.css'?>">
	<link rel="stylesheet" type="text/css" href="<?php echo $url.'/css/icon.css'?>">
	

<?php 
Yii::app()->clientScript->registerScript("detailView", "
		
		$(function(){
			$('#dg').datagrid({
				view: detailview,
				detailFormatter:function(index,row){
					return '<div style=\"padding:2px;background-color:#6495ed;\"><table id=\"ddv-'+index+'\"></table></div>';
				},
				onExpandRow: function(index,row){
					$('#ddv-'+index).datagrid({
						url:'getdetail?owner='+row.id,
						fitColumns:true,
						singleSelect:true,
						height:'auto',
						columns:[[
							{field:'name',title:'Nama Unit',width:100},
							{field:'imei',title:'No. IMEI',width:100},
							{field:'tipe',title:'Tipe GPS',width:100},
							{field:'no_sim_card',title:'Nomor SIM Card',width:100},
							{field:'status_gprs',title:'Status GPRS',width:100},
							{field:'gmt',title:'GMT',width:100}
						]],
						onResize:function(){
							$('#dg').datagrid('fixDetailRowHeight',index);
						},
						onLoadSuccess:function(){
							setTimeout(function(){
								$('#dg').datagrid('fixDetailRowHeight',index);
							},0);
						}
					});
					$('#dg').datagrid('fixDetailRowHeight',index);
				}
			});
		});
		", CClientScript::POS_HEAD);
?>

	<table id="dg" style="height:350px; weight: 750px"
			url="<?php echo CController::createUrl('users/getdata')?>" 
			title="Unit List "
			singleSelect="true" fitColumns="true">
		<thead>
			<tr>
				<th field="username" width="80">Username</th>
				<th field="fname" width="100">Nama Depan</th>
				<th field="lname" align="right" width="80">Nama Belakang</th>
				
			</tr>
		</thead>
	</table>



yang jadi pertanyaan ane ..
kira-kira kenapa ya sob, data tidak muncul / terload di grid.
Mohon masukannya..

thnks before :)

Attached File(s)


0

#2 User is offline   myrazel 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 29-April 12

Posted 13 May 2012 - 04:28 AM

ane masih newbie nih.

tapi menurut ane, data dari databasenya belom di render.

sama url di ajaxnya salah.

maaf banget nih kalau salah
0

#3 User is offline   xicond 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 34
  • Joined: 06-October 12

Posted 18 October 2012 - 06:38 AM

View PostA Ginanjar, on 08 May 2012 - 05:50 AM, said:

Halo Yii-ers ..

Thread pertamax nih :D
oia saya mau tanya soal grid-grid :blink:
awalnya ane liat-liat disini.. http : //www*jeasyui*com/tutorial/datagrid/datagrid22_demo.html
source code / dokumentasi dari sononya kurang lebih seperti ini : http : //www*jeasyui*com/tutorial/datagrid/datagrid22.php

trus ane rubah-rubah dikit disesuaikan dengan aplikasi di ane. Masih menggunakan PHP dan Query (tanpa Yii)
dan bisa jalan..

kemudian ane coba masukkan ke Yii..
ane bikin fungsi di controller dengan nama getData ama getDetail..

controller >>
public function actionGetdata(){
		$result = array();
	
		$rs = Users::model()->findAll();
	
		$items = array();
		foreach($rs as $row)
		{
			
			array_push($items, $row->getAttributes(array('id','username', 'fname', 'lname'))); 
		}
		echo json_encode($items);
	}
public function actionGetdetail(){
		$itemid = $_GET['owner'];
		
		$rs = Units::model()->findAllByAttributes(array('owner'=>$itemid));
		$items = array();
		foreach($rs as $row)
		{
			$items[] = $row->getAttributes(array('name', 'imei', 'tipe', 'no_sim_card', 'status_gprs', 'gmt'));
		}
		echo json_encode($items);
	}

oia ane juga udah set access Rule nya untuk getData dan getDetail.

dan untuk view nya kurang lebih seperti ini
View >>
<?php 
$url = Yii::app()->baseUrl;

$cs = Yii::app()->getClientScript();
$cs->registerScriptFile(bu().'/js/jquery-easyui-1.2.6/jquery-1.7.2.min.js');
$cs->registerScriptFile($url.'/js/data-grid/jquery.easyui.min.js');
$cs->registerScriptFile($url.'/js/data-grid/datagrid-detailview.js');

	?>
	
	<link rel="stylesheet" type="text/css" href="<?php echo $url.'/css/demo.css'?>">
	<link rel="stylesheet" type="text/css" href="<?php echo $url.'/css/easyui.css'?>">
	<link rel="stylesheet" type="text/css" href="<?php echo $url.'/css/icon.css'?>">
	

<?php 
Yii::app()->clientScript->registerScript("detailView", "
		
		$(function(){
			$('#dg').datagrid({
				view: detailview,
				detailFormatter:function(index,row){
					return '<div style=\"padding:2px;background-color:#6495ed;\"><table id=\"ddv-'+index+'\"></table></div>';
				},
				onExpandRow: function(index,row){
					$('#ddv-'+index).datagrid({
						url:'getdetail?owner='+row.id,
						fitColumns:true,
						singleSelect:true,
						height:'auto',
						columns:[[
							{field:'name',title:'Nama Unit',width:100},
							{field:'imei',title:'No. IMEI',width:100},
							{field:'tipe',title:'Tipe GPS',width:100},
							{field:'no_sim_card',title:'Nomor SIM Card',width:100},
							{field:'status_gprs',title:'Status GPRS',width:100},
							{field:'gmt',title:'GMT',width:100}
						]],
						onResize:function(){
							$('#dg').datagrid('fixDetailRowHeight',index);
						},
						onLoadSuccess:function(){
							setTimeout(function(){
								$('#dg').datagrid('fixDetailRowHeight',index);
							},0);
						}
					});
					$('#dg').datagrid('fixDetailRowHeight',index);
				}
			});
		});
		", CClientScript::POS_HEAD);
?>

	<table id="dg" style="height:350px; weight: 750px"
			url="<?php echo CController::createUrl('users/getdata')?>" 
			title="Unit List "
			singleSelect="true" fitColumns="true">
		<thead>
			<tr>
				<th field="username" width="80">Username</th>
				<th field="fname" width="100">Nama Depan</th>
				<th field="lname" align="right" width="80">Nama Belakang</th>
				
			</tr>
		</thead>
	</table>



yang jadi pertanyaan ane ..
kira-kira kenapa ya sob, data tidak muncul / terload di grid.
Mohon masukannya..

thnks before :)

Fyi, The biggest yii Indonesian Group to talk
http://www.facebook..../yii.indonesia/
0

#4 User is offline   Praying Mantis 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 27-June 13

Posted 27 June 2013 - 10:44 PM

A Ginanjar : saya udah ketemu gan nih caranya... sempet ngalamin masalah yang sama. Agan pakai blueprint css bawaan yii juga yah di themesnya ?
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users