I just wonder why the size/width in Product Grid in the admin panel is not adjusting. I created a local copy of the grid.php from the core file. I tried editing the sizes of the column (/app/code/local/Mage/Adminhtml/Block/Catalog/Product/Grid.php) but when I try to refresh the admin page nothing happens. I cleared the cache still the same the width are the same.
Can anyone guide me how to increase the width size of every column?
EDIT:
In addition, is there a way I can the FROM and TO in the PRICE and QTY Column? How?
-
Have you added such column to grid collection?zhartaunik– zhartaunik2015年08月03日 08:50:22 +00:00Commented Aug 3, 2015 at 8:50
-
there is a 'width' => '70px', option for each column in _prepareColumns() function of grid.phpsaravanavelu– saravanavelu2015年08月03日 09:02:36 +00:00Commented Aug 3, 2015 at 9:02
-
Yes, I tried that one as mentioned above but it's not workingKiD Cajes– KiD Cajes2015年08月03日 09:15:29 +00:00Commented Aug 3, 2015 at 9:15
-
It works fine for me. check after clearing cachesaravanavelu– saravanavelu2015年08月03日 09:19:03 +00:00Commented Aug 3, 2015 at 9:19
-
It should be. I tried clearing all cache and even flushed it but to no availKiD Cajes– KiD Cajes2015年08月03日 09:23:41 +00:00Commented Aug 3, 2015 at 9:23
3 Answers 3
If you remove 'type' => 'number' from the array then you will be able to change the width.
-
I have faced same problem, when I remove 'type', I am able adjust the width, else not. I can't find logic behind itAbdul Ghaffar– Abdul Ghaffar2016年05月26日 11:28:32 +00:00Commented May 26, 2016 at 11:28
Try the below,
In app/code/local/Mage/Adminhtml/Block/Catalog/Product/Grid.php
Under _prepareColumns() function,
$this->addColumn('entity_id',
array(
'header'=> Mage::helper('catalog')->__('ID'),
'width' => '50px',
'type' => 'number',
'index' => 'entity_id',
));
By changing this 'width' => '50px',the column width can be changed
-
With the help of width you can set the width of column, you can change as per your requirements.Kinjalkumar Prajapati– Kinjalkumar Prajapati2015年08月03日 09:15:45 +00:00Commented Aug 3, 2015 at 9:15
-
The way I understand it first, yes I'll just have to adjust the width of every column in _prepareColumns() but the thing is, it's not working. So I was thinking that maybe there's still a different file that needed to be edited.KiD Cajes– KiD Cajes2015年08月03日 09:20:25 +00:00Commented Aug 3, 2015 at 9:20
For those 'width' => '{number}px', is not working as intended, if you have a hidden column, the width change will take place x column(s) earlier.
For example, if you have columns as follows, you will have to place 'width' => '25px' in the column2 in order to change the width of column3
$this->addColumn('hidden_column1', array('header' => 'hidden_column1', 'column_css_class'=>'no-display', 'header_css_class'=>'no-display'));
$this->addColumn('column2',
array(
'header' => 'column2',
'width' => '25px', //here
));
$this->addColumn('column3',
array(
'header' => 'column3',
//not here
));
Explore related questions
See similar questions with these tags.