I'm a newbie to yii and have difficulty on using subform and gridview.
I want to create a simple accounting journal with these tables:
t_journal
---------
id_journal
dates
t_journal_detail
----------------
id
id_journal
journal_code
journal_name
desc
debit_value
credit_value
I'd like to use two gridview for this, one for t_journal, and one for t_journal_detail which is inside t_journal gridview, just like below:
$this->widget( 'bootstrap.widgets.TbGridView', array(
'id' => 'jurnal-harian-grid',
'template' => "<div>{pager}</div><div style='float:left;'>{summary}</div><div class='clear'> </div>\n{items}\n<div>{pager}</div><div style='float:left;'>{summary}</div><div class='clear'> </div><br/>",
'dataProvider' => $model->search(),
'columns' => array(
array(
'name' => 'id_journal',
'header' => 'ID',
),
array(
'name' => 'dates',
'header' => 'Date',
'value' => 'date("d-m-Y",strtotime($data["dates"]))',
),
array(
'header' => 'Details',
'value' => $this->renderPartial('_subjurnal', array("modelDetail"=>$modelDetail), true),
),
),
) );
inside _subjurnal.php, I insert a one column table with word "Testing"
<table border="0">
<tr>
<td>Testing</td>
</tr>
</table>
Is that the right way to insert another subform or subpage inside gridview? Because I got an error on every row of journal gridview:
Parse error: syntax error, unexpected '<' in D:\xampp\htdocs\cvsunrise\yii\framework\base\CComponent.php(616) : eval()'d code on line 1
What is the right way to do that? A help for this would be much appreciated.