RenderPartial w/ CTreeView & CListView
CListViewCTreeViewrenderPartial
Hello all,
I’m currently using a CtreeView (as leftside menu) w/ links on each of the elements.
Links are “…/controler/action?elemento=4″
Where elemento is category items wanting to display.
In the middle is a listView which show items by categories.
IE.
empty(elemento) –> show all category items
elemento=1 –> show items which have category 1
But when I click left side links (it takes me to the correct page) but the CTreeView colapses & looses it’s current open hierarchy state.
I am thinking of 1 of 2 ways to so solve this:
1.- pass a parameter in URL to set the ctreeview lastState. How?
2.- renderPartial (ClistView) on click of CTreeView
In controller I have
- if(isset($_GET['elemento'])){
- $this->renderPartial('clistView',array('dataProvider'=>$dataProvider),true,false);
- }
if(isset($_GET['elemento'])){
$this->renderPartial('clistView',array('dataProvider'=>$dataProvider),true,false);
} in View
- ...
- echo $this->renderPartial('clistView',array('dataProvider'=>$dataProvider));
- ...
- $this->widget('CTreeView',array(
- 'id'=>'menu-treeview',
- 'url' => array('ajaxFillTree'), )) ;
- ...
...
echo $this->renderPartial('clistView',array('dataProvider'=>$dataProvider));
...
$this->widget('CTreeView',array(
'id'=>'menu-treeview',
'url' => array('ajaxFillTree'), )) ;
...I do not have a grasp on what renderPatial Vs. render does. And does this help w/ my current problem.
Thanks
By tuolden in List View · Asked 579 days 10 hours 22 mins ago
Questions: 25 Accepted: 0 ( 0% ) | Reputation: 0
Possibly related Questions
-
Ajax Cform validation within renderPartial view
February 7, 2012 By TheDeveloper 4 Answers
TAGS
actioncreate ( x 2 )ACTIVERECORD ( x 4 )AJAX ( x 10 )ajaxSubmitButton ( x 4 )AR ( x 2 )cactivedataprovider ( x 2 )CActiveForm ( x 2 )cactiverecord ( x 2 )CGridView ( x 14 )CJuiAutoComplete ( x 3 )CJuiDialog ( x 8 )CListView ( x 8 )controller ( x 7 )Css ( x 2 )CStarRating ( x 2 )CTreeView ( x 2 )database ( x 5 )dialog ( x 2 )dropdownlist ( x 3 )EGMaps ( x 3 )extension ( x 3 )file ( x 2 )form ( x 6 )Giix ( x 2 )gridview ( x 2 )html ( x 2 )javascript ( x 3 )many_many ( x 4 )merge ( x 2 )model ( x 4 )Modules ( x 3 )multilanguage ( x 2 )php ( x 2 )redirect ( x 4 )Registration ( x 3 )relations ( x 5 )renderPartial ( x 8 )session ( x 2 )sorting ( x 3 )sql ( x 4 )url ( x 3 )urlManager ( x 3 )validation ( x 3 )yii ( x 11 )YiiAnswers Site ( x 4 )This website counts Questions and 429 Answers by 7751 registered users.

I think your second option is best so you do not have to duplicate tree rendering on each tree node call. I assume that the second option is an AJAX call, thus renderPartial is echoing just that part that you need to render without the header and footer of layouts.
From yiiframework about renderPartial:
This method differs from render() in that it does not apply a layout to the rendered result. It is thus mostly used in rendering a partial view, or an AJAX response
By tonydspaniard · 579 days 10 hours 4 mins ago
Questions: 2 Accepted: 0 ( 0% ) | Reputation: 0
Great…
The solution for anyone else was to create a new action for the controller
IE. actionUpdateAjax
At the end …
this->renderPartial(‘element’, array(‘dataProvider’=>$dataProvider,) , false, true);
For more information please look at here
By tuolden · 578 days 13 hours 34 mins ago
Questions: 25 Accepted: 0 ( 0% ) | Reputation: 0