Yii Framework Forum: How To Best Create A Simple Master Detail Screen - Yii Framework Forum

Jump to content

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

How To Best Create A Simple Master Detail Screen Rate Topic: -----

#1 User is offline   AustinGeek 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 173
  • Joined: 22-September 12

Posted 31 January 2013 - 06:54 PM

I would like to use four models in a master detail screen.

Master Model : Client
Detail Model : Address (MANY)
Detail Model : Account (MANY)
Detail Model : Contacts (MANY)
Detail Model : Sites (MANY)

If I use the Gii generated forms, I can use a CJuiTab widget to display the detail models

$model is the Client model.
$this-> is the Client Controller


The problem I am having is ->find() works to grab the client Address but not the correct address. I need to pass
it 'client_id'=>$model->id so it returns the client Address.



$this->widget('zii.widgets.jui.CJuiTabs', array(
    'tabs'=>array(        
        'Client'=>$this->renderPartial('_form', array(
			'model'=>$model), true),
        'Address'=>$this->renderPartial('_clientAddress/_form', array(
			'model'=>ClientAddress::model()->find()), true), 
    ),
    'options'=>array(
        'collapsible'=>false,
        'selected'=>0,
    ),
    'htmlOptions'=>array(
        'style'=>'width:700px;'
    ),
));


I would really like to pass it an array of Client Addresses but I can't do that with the _form.
I would need to use CGridView then open each address for editing

It seems very complex for something that should be simple.

Am I not being Yii enough and thinking too relationally? I haven't broken the Oracle Forms habits.

Thanks for any advice!
0

#2 User is offline   waitforit 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 383
  • Joined: 09-February 11

Posted 01 February 2013 - 12:21 AM

Why not just do ajax tabs and pass the ID of the 'master' model to the ajax child tab?

Check this link for some ideas on master-detail. Start with something simple (one master one child) and go from there.
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