5

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?

7
  • Have you added such column to grid collection?
    – zhartaunik
    Aug 3 '15 at 8:50
  • there is a 'width' => '70px', option for each column in _prepareColumns() function of grid.php Aug 3 '15 at 9:02
  • Yes, I tried that one as mentioned above but it's not working
    – KiD Cajes
    Aug 3 '15 at 9:15
  • It works fine for me. check after clearing cache Aug 3 '15 at 9:19
  • It should be. I tried clearing all cache and even flushed it but to no avail
    – KiD Cajes
    Aug 3 '15 at 9:23
4

If you remove 'type' => 'number' from the array then you will be able to change the width.

1
  • I have faced same problem, when I remove 'type', I am able adjust the width, else not. I can't find logic behind it May 26 '16 at 11:28
3

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

2
  • With the help of width you can set the width of column, you can change as per your requirements. Aug 3 '15 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
    Aug 3 '15 at 9:20
0

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
        ));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.