alankar1985
(Alankar Singh1985)
February 10, 2013, 2:51pm
1
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
seenivasan
(Chellamnivas)
February 10, 2013, 4:24pm
2
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.
Coksnuss
(Schanz15)
February 10, 2013, 5:44pm
3
You could also simply created a new class like this, and use that instead of CGridView
protected/components/GridView.php
[CODE]<?php
class GridView extends CGridView
{
public $cssFile = 'yourStyle.css';
}
?>[/CODE]
alankar1985
(Alankar Singh1985)
February 10, 2013, 6:07pm
4
Coksnuss:
You could also simply created a new class like this, and use that instead of CGridView
protected/components/GridView.php
[CODE]<?php
class GridView extends CGridView
{
public $cssFile = 'yourStyle.css';
}
?>[/CODE]
Hi Coksnuss,
Can you elaborate me more, means how can i call this $cssFile variable in zii grid.
Coksnuss
(Schanz15)
February 10, 2013, 6:36pm
5
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?
alankar1985
(Alankar Singh1985)
February 10, 2013, 7:51pm
6
Coksnuss:
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
Coksnuss
(Schanz15)
February 10, 2013, 8:05pm
7
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.
alankar1985
(Alankar Singh1985)
February 11, 2013, 5:04pm
9
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
le_top
(Ext Yiiframework Com)
February 11, 2013, 11:23pm
10
Hi
As it looks like this was not stated explicitally:
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!
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.
alankar1985
(Alankar Singh1985)
February 19, 2013, 4:17pm
11
Hi Coksnuss
Can you tell me also how can i change button path of zii grid view
Coksnuss
(Schanz15)
February 20, 2013, 10:11am
12