0

I have added a custom Tab grid to Form Section in my custom module, now I need to add some custom Column of checkbox type to my custom grid, which I added as per snapshot -

but all the custom Checkbox are coming disabled, I need these checkboxes enabled.

enter image description here

  • Please share the code – Arunendra May 30 '16 at 6:36
1

Please consider the following things.

For example:

if your attribute is banner_gral Then in your controller saveAction() when saving the checkbox data do

$banner_gral = isset($your_form_Data['banner_gral']) ? 1 : 0;

For Grid and Form Page

In your controller you should have Mage::register(...)->getData() or Mage::register(...)

public function editAction()
     ....
     Mage::register('example_data', $model);

On your form _prepareForm()

$model = Mage::registry('example_data'); // NOTE registry('example_data'); NOT registry('example_data')->getData();

$fieldset->addField('entire_range', 'checkbox', array(
      ....
      'checked'    => $model->getBannerGral()==1 ? 'true' : 'false',
       ......
))

On your grid _prepareColumns()

$this->addColumn('banner_gral', array(
    ....
    'type'     => 'checkbox',
    'index'    => 'banner_gral',
    'values'   => array(1,2),
    'field_name' => 'checkbox_name',
    ....
));
  • Hi, not fully but some points in your answer has helped me, so +1 – amit_game Jun 3 '16 at 12:07
  • Do you guys know how to do this exactly? because i'm on this situation and dont know how to do that, on catalog_category_product, they can checkbox checked, but i'm follow them and doesn't checked at all. @@ the values i put in is a array just like them did. Like this (1,2) – fudu Aug 11 '18 at 8:16

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.