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

Teja Bhagavan Kollepara
3,8275 gold badges33 silver badges69 bronze badges
asked May 30, 2016 at 6:19
1
  • Please share the code Commented May 30, 2016 at 6:36

1 Answer 1

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',
 ....
));
answered May 30, 2016 at 6:44
2
  • Hi, not fully but some points in your answer has helped me, so +1 Commented Jun 3, 2016 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) Commented Aug 11, 2018 at 8:16

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.