Yii Framework Forum: Yii Assets - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Yii Assets stop assets to install again and again Rate Topic: -----

#1 User is offline   Alankar Singh 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 42
  • Joined: 22-March 12

Posted 10 February 2013 - 09:51 AM

Hi,
I working in a project where i have to deploy project files in installer. but i have make some changes in zii grid view layout.
So each and every time when i install my project, zii grid layout change to its default layout (blue header).

Please anyone can help me how to layout zii grid view permanently means it will not change its layout on new server

Thanks in advance :)
0

#2 User is offline   seenivasan 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 620
  • Joined: 17-June 12
  • Location:Chennai,TamilNadu,India.

Posted 10 February 2013 - 11:24 AM

Dear Friend

We can copy the folder framework/zii/widgets/grid/gridview.

Put the contents inside the webroot/css folder.

You can remove the jquery.yiigridview.js inside the folder.

You can make modification there in styles.css file.

Now in admin.php we have set the cssFile Path.


<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'alphabet-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'cssFile'=>'css/gridview/styles.css',
	'columns'=>array(

.........................................................


But every admin.php, we have to do this modification if you want the changes and changes to persist.

Regards.
0

#3 User is offline   Coksnuss 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 140
  • Joined: 14-May 09

Posted 10 February 2013 - 12:44 PM

View Postseenivasan, on 10 February 2013 - 11:24 AM, said:

But every admin.php, we have to do this modification if you want the changes and changes to persist.


You could also simply created a new class like this, and use that instead of CGridView
protected/components/GridView.php
<?php
class GridView extends CGridView
{
    public $cssFile = 'yourStyle.css';
}
?>

0

#4 User is offline   Alankar Singh 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 42
  • Joined: 22-March 12

Posted 10 February 2013 - 01:07 PM

View PostCoksnuss, on 10 February 2013 - 12:44 PM, said:

You could also simply created a new class like this, and use that instead of CGridView
protected/components/GridView.php
<?php
class GridView extends CGridView
{
    public $cssFile = 'yourStyle.css';
}
?>




Hi Coksnuss,
Can you elaborate me more, means how can i call this $cssFile variable in zii grid.
0

#5 User is offline   Coksnuss 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 140
  • Joined: 14-May 09

Posted 10 February 2013 - 01:36 PM

View PostAlankar Singh, on 10 February 2013 - 01:07 PM, said:

Hi Coksnuss,
Can you elaborate me more, means how can i call this $cssFile variable in zii grid.


What exactly do you need to know?

From what I have understood, you've changed the source code @framework/zii/widgets/grid/CGridView.php and searching for a way to do this changes without changing the framework files. Am I correct with that?

If I am correct: What exactly did you changed?
0

#6 User is offline   Alankar Singh 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 42
  • Joined: 22-March 12

Posted 10 February 2013 - 02:51 PM

View PostCoksnuss, on 10 February 2013 - 01:36 PM, said:

What exactly do you need to know?

From what I have understood, you've changed the source code @framework/zii/widgets/grid/CGridView.php and searching for a way to do this changes without changing the framework files. Am I correct with that?

If I am correct: What exactly did you changed?


No, in asset folder there are some files for zii grid view, i changed that but when i upload the same project on different server in asset folder new folder is generate for zii.

I just want a way by that if i fixed the layout of grid view then i dont need to change it on different servers.

Thanks
0

#7 User is offline   Coksnuss 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 140
  • Joined: 14-May 09

Posted 10 February 2013 - 03:05 PM

View PostAlankar Singh, on 10 February 2013 - 02:51 PM, said:

No, in asset folder there are some files for zii grid view, i changed that but when i upload the same project on different server in asset folder new folder is generate for zii.

I just want a way by that if i fixed the layout of grid view then i dont need to change it on different servers.

Thanks


Ah ok, I see. Well then you can use my provided solution without any problems.
The approach in detail (assuming default paths)

protected/config/main.php
return array(
[...]
'import' => array('application.components.*'),
[...]


protected/componentns/GridView.php
Yii::import('zii.widgets.grid.CGridView');
class GridView extends CGridView
{
    public function init()
    {
        $this->cssFile = Yii::app()->baseUrl . '/css/gridview.css';
        parent::init();
    }
}


css/gridview.css
Just copy&paste the content of your modified style.css in here.


Now simply search and replace all calls of
$this->widget('zii.widgets.grid.CGridView', array(...));

to
$this->widget('GridView', array(...));


Done.
0

#8 User is offline   Alankar Singh 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 42
  • Joined: 22-March 12

Posted 11 February 2013 - 11:46 AM

View PostCoksnuss, on 10 February 2013 - 03:05 PM, said:

Ah ok, I see. Well then you can use my provided solution without any problems.
The approach in detail (assuming default paths)

protected/config/main.php
return array(
[...]
'import' => array('application.components.*'),
[...]


protected/componentns/GridView.php
Yii::import('zii.widgets.grid.CGridView');
class GridView extends CGridView
{
    public function init()
    {
        $this->cssFile = Yii::app()->baseUrl . '/css/gridview.css';
        parent::init();
    }
}


css/gridview.css
Just copy&paste the content of your modified style.css in here.


Now simply search and replace all calls of
$this->widget('zii.widgets.grid.CGridView', array(...));

to
$this->widget('GridView', array(...));


Done.


Thanks :)
0

#9 User is offline   Alankar Singh 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 42
  • Joined: 22-March 12

Posted 11 February 2013 - 12:04 PM

Hi Coksnuss

One more help, in zii grid, when i enter something in filter textboxes, loading image is show but it does not filter the result, what is the issue ?

Thanks in advanced
0

#10 User is offline   le_top 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 325
  • Joined: 08-June 10
  • Location:France

Posted 11 February 2013 - 06:23 PM

Hi
As it looks like this was not stated explicitally:
1. You should not manually change any file under the 'assets' folder. The files there are copied/generated. At best you should make sure that your setup is still working after deleting the entire assets contents!
2. You can specify your own 'css' file as indicated above by specifying this as an option to the gridview, or you can create a CSS file that you also load in which you create more specific rules. One technique I use is to add 'body' in tront of the rule - the body is always available and it makes the rule more specific.
So:
".gridview .abc { color: green; }" would become "body .gridview abc {color: red; }" if you prefer to use read for ".gridview .abc" rather than the default green.
0

#11 User is offline   Alankar Singh 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 42
  • Joined: 22-March 12

Posted 19 February 2013 - 11:17 AM

Hi Coksnuss

Can you tell me also how can i change button path of zii grid view
0

#12 User is offline   Coksnuss 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 140
  • Joined: 14-May 09

Posted 20 February 2013 - 05:11 AM

Hi,

please refer to the API Documentation:

http://www.yiiframew...uttonUrl-detail
http://www.yiiframew...uttonUrl-detail
http://www.yiiframew...uttonUrl-detail

for example:
array(
 'class' => 'CButtonColumn',
 'viewButtonUrl' => 'Yii::app()->controller->createUrl("yourViewAction", array("parameter1" => "value1"))',
)

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users