在配置文件中定义Yii Booster扩展


Define Yii-Booster Extension in Configuration file

我是新手,我已经下载了Yii Booster Widgets用于TBRelationalColumn。

我已经从yiiboster.clevertech.biz yiiboster-4.0.1.zip文件下载了扩展名,并在下提取

protected/extensions/booster

配置protected/config/local.php和main.php

  <?php
    Yii::setPathOfAlias('booster', dirname(__FILE__).'/../extensions/booster');
    Yii::setPathOfAlias('bootstrap', dirname(__FILE__).'/../extensions/bootstrap');   
    return array(
        'components'=>array(
            'db' => array(              
            ),
                'mongodb' => array(
            'class'            => 'EMongoDB',         
          ),
           'booster'=>array(
                'class'=>'booster.components.Booster',
                'coreCss' => true,
                'responsiveCss' => true,
                'yiiCss' => true,
            ),
            'bootstrap'=>array(             
               'class'=>'bootstrap.components.bootstrap',
                'coreCss' => true,
                'responsiveCss' => true,
                'yiiCss' => true,
            ),
            'cache'=>array(
                'class' => 'CFileCache',
            ),
        ),
    );

当我使用这个小部件时,我得到了网格结构,但js没有启用index.php

$this->widget('booster.widgets.TbExtendedGridView', array(
        'id' => 'invite-grid',
        'type' => 'striped condensed',
        'dataProvider' => $arrayDataProvider,      
        'columns' => array(
            'id',
            'username',
            'email',
            array(
                'class' => 'booster.widgets.TbRelationalColumn',
                'name' => 'test',
                'value' => '"grid"',
                'url' => $this->createUrl('site/relational'),
                'afterAjaxUpdate' => 'js:function(tr,rowid,data){
bootbox.alert("I have afterAjax events too!<br/>This will only happen once for row with id: "+rowid);
}'
            ),                        
            )
    ));

当点击网格时,我无法获得警报消息。请任何人帮助我解决这个问题

您没有加载它。如果您在所有页面上使用boostrap,请从配置预加载它

return array(
    'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
    'name'=>'My Site',
    'preload'=>array(
        'log',
        'bootstrap', //preload bootsrtap
        ),

否则,您可以使用过滤器为每个控制器单独添加它

public function filters()
    {
        return array(
            'accessControl', 
            array('ext.booster.filters.BootstrapFilter') //load bootstrap
        );