【问题标题】:Define Yii-Booster Extension in Configuration file在配置文件中定义 Yii-Booster 扩展
【发布时间】:2014-09-23 11:56:10
【问题描述】:

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

我已经从 yiibooster.clevertech.biz yiibooster-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);
}'
            ),                        
            )
    ));

单击网格时,我无法收到警报消息。请任何人帮我解决这个问题

【问题讨论】:

    标签: php yii yii-extensions yii-components yii-booster


    【解决方案1】:

    你没有加载它。如果您在所有页面上使用 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
            );
    

    【讨论】:

    • 检查控制台 (chrome/ff) 看看你是否遇到任何奇怪的 js/网络错误
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多