Replace default jquery-ui.css default path

I am trying to get Yii 1.1.16 to read my user file jQuery-ui.min.cssinstead of the one that appears by default.

I tried editing clientScriptin mine main.php, but didn't seem to be able to get it working.

Here is my code

'components'=>array(
        'clientScript'=>array(
            'scriptMap' => array(
                'jquery-ui.css' => '/css/jquery-ui.min.css',
            ),
            'packages'=>array(
                'jquery'=>array(
                    'baseUrl'=>'js/',
                    'js'=>array('jquery.min.js'),
                ),
               'jquery.ui'=>array(
                    'baseUrl'=>'',
                    'js'=>array('js/jquery-ui.min.js'),
                    'depends' => array('jquery')
                ),
            ),

It adds the default css every time I call the widget CJuiButton. Any solutions?

+4
source share
1 answer

Make sure you set the correct configuration (main.php) in index.php:

$config = dirname(__FILE__) . '/../app/config/main.php';
Yii::createWebApplication($config)->run();

If it does not work, add the code below zii.widgets.jui.CJuiButton, the calling widget:

Yii::app()->clientScript->scriptMap = array(
    'jquery-ui.css' => '/css/jquery-ui.min.css',
);
$this->widget('zii.widgets.jui.CJuiButton',array(
    'buttonType'=>'submit',
    'name'=>'btnSubmit',
    'value'=>'1',
    'caption'=>'Submit form',
    'htmlOptions'=>array('class'=>'ui-button-primary')
    )
);
+1
source

Source: https://habr.com/ru/post/1606088/


All Articles