I have been using Yii for about 6 months now and have found pretty much anything I needed to know around here except for this.
I have my main CMenu that links to a page that has AjaxLinks in it. Usually when you go to the page (we’ll call it page ‘B’) the first page shows up (B1), but I need to link to the page and have it go to a different partialrender view which is accomplished through and AjaxLink.
Say page B has a menu on the side, 1, 2, 3, 4 . When I get to page B, the first view “B1” always shows up, here when I click this certain CMenu link I need B3 to show up. Like an automatic ‘click’ on menu item B3.
my CMenu code is this:
$this->widget('zii.widgets.CMenu', array('items'=>array( array('label'=>'Top Articles', 'url'=>array('/articles')), array('label'=>'My Articles','url'=>array('/user/profile')), array('label'=>'Submit Article','url'=>array('/articles/create')) )))
When I click on ‘My Articles’ from CMenu I need the ajaxLink for articles to be ‘clicked’ and show up automatically so it updates the .datagrid with ‘getProfileArticles’ instead of the persons info.
<ul> <li><?php echo CHtml::ajaxLink('Info',array('/user/profile/'),array('update'=>'.dataGrid')); ?></li> <li><?php echo CHtml::ajaxLink('Articles',array('/user/profile/getProfileArticles'),array('update'=>'.dataGrid')); ?></li> <li><?php echo CHtml::ajaxLink('Micro Blog',array('/user/profile/blogCreate'),array('update'=>'.dataGrid')); ?></li> </ul>
I hope this makes enough sense!
Is this possible? I’d hate to create a duplicate page when I can just link right here.