redant
(A Red)
April 18, 2012, 3:20pm
1
This is a real newbie question but one that has had me stumped for a whole day. I hope someone can spot my mistake and help me correct it. I have searched google and the forums but there is obviously something I am not understanding.
I have created a model named UserUpdate and generated the CRUD content.
Within the views/index.php I have the following code snippet:
<?php $this->widget('CTabView',array(
'activeTab'=>'tab1',
'tabs'=>array(
'tab1'=>array(
'title'=>'Static tab',
'content'=>'Content for tab 1'
),
'tab2'=>array(
'title'=>'Test tab',
'content'=>$this->widget('zii.widgets.CListView',
array('dataProvider'=>$dataProvider,
'itemView'=>'_view',),true)
)),
this renders a blank page with no content when viewed in the browser.
If I change the tab2 code to:
'tab2'=>array(
'title'=>'Test tab',
'view'=>'/UserUpdate/_view'
),
it renders a page without tabs but with links which are not active.
Could someone please explain why these are not working as expected.
Thanks in advance.
rootbear
(Alex Xm)
April 18, 2012, 3:50pm
2
redant:
This is a real newbie question but one that has had me stumped for a whole day. I hope someone can spot my mistake and help me correct it. I have searched google and the forums but there is obviously something I am not understanding.
I have created a model named UserUpdate and generated the CRUD content.
Within the views/index.php I have the following code snippet:
<?php $this->widget('CTabView',array(
'activeTab'=>'tab1',
'tabs'=>array(
'tab1'=>array(
'title'=>'Static tab',
'content'=>'Content for tab 1'
),
'tab2'=>array(
'title'=>'Test tab',
'content'=>$this->widget('zii.widgets.CListView',
array('dataProvider'=>$dataProvider,
'itemView'=>'_view',),true)
)),
this renders a blank page with no content when viewed in the browser.
If I change the tab2 code to:
'tab2'=>array(
'title'=>'Test tab',
'view'=>'/UserUpdate/_view'
),
it renders a page without tabs but with links which are not active.
Could someone please explain why these are not working as expected.
Thanks in advance.
just a thought,
in your method 2, try static content in _view to see if tab show ok;
if works, switch back to your listview, also try passing data to partial like
'tab2'=>array(
'title'=>'Test tab',
'view'=>'/UserUpdate/_view',
'data'=>array('model'=>$model),
),
redant
(A Red)
April 19, 2012, 4:34am
3
Thanks for the reply rootbear.
Your suggestion 1 renders a blank page
Your suggestion 2 renders a page with links and no tabs. The links are not active.
If I change the code to:
'tab2'=>array(
'title'=>'Render tab',
'view'=>'/site/index',
),
It works correctly.
It seems (I have not tested them all) that any page in any folder below /site gives one of the errors described above.
I found this link My link where meanpenguin was having a similar issue but his suggestions have not resolved my issue.
redant
(A Red)
April 26, 2012, 6:00am
4
Has anyone had more thoughts about this?
If so, I would really appreciate your help and comments as it continues to stump me.
Just for the sake of clarity:
if I use
'view'=>'/site/index',
in the tab2 body the page renders correctly (as in graphic below.)
2801
correct1.PNG
if I use
'view'=>'/UserUpdate/_view',
the page does not render correctly and the links which are displayed do not work(as in graphic below.)
2802
incorrect.PNG
Thanks in advance for any help or insight.
redant
(A Red)
May 19, 2012, 4:33am
5
redant:
Has anyone had more thoughts about this?
If so, I would really appreciate your help and comments as it continues to stump me.
Just for the sake of clarity:
if I use
'view'=>'/site/index',
in the tab2 body the page renders correctly (as in graphic below.)
2801
correct1.PNG
if I use
'view'=>'/UserUpdate/_view',
the page does not render correctly and the links which are displayed do not work(as in graphic below.)
2802
incorrect.PNG
Thanks in advance for any help or insight.
I have not had much time to revisit this or to examine what the differencce is between CTabView and CJuiTabs but after getting back to it I found that using the CJuiTabs widget was the answer.
In case someone else is battling the same issue, here is what worked for me:
$this->widget('zii.widgets.jui.CJuiTabs', array(
'tabs'=>array(
'Tab 1'=>array('content'=>'UserFirstName'),
'Tab 2'=>array('ajax'=>$this->createUrl('Users/create')),
'Tab 3'=>array('ajax'=>$this->createUrl('Users/admin')),
),
// additional javascript options for the tabs plugin
'options'=>array(
'collapsible'=>true,
),
));