I have admin form with grid. in my grid i have set checkbox as another form field but it gives disabled when it rendered.My code is as below.
Layout file.
<shippinggroup_adminhtml_shippinggroup_customers>
<block type="core/text_list" name="root" output="toHtml">
<block type="shippinggroup/adminhtml_shippinggroup_edit_tab_formcustomer" name="shippinggroup.edit.tab.formcustomer" />
<block type="adminhtml/widget_grid_serializer" name="customer_grid_serializer" >
<action method="initSerializerBlock">
<grid_block_name>shippinggroup.edit.tab.formcustomer</grid_block_name>
<data_callback>getSelectedCustomers</data_callback>
<hidden_input_name>links[customer_ids]</hidden_input_name>
<reload_param_name>customer</reload_param_name>
</action>
<action method="addColumnInputName">
<input_name>warrantymail</input_name>
</action>
</block>
</block>
</shippinggroup_adminhtml_shippinggroup_customers>
grid column.
$this->addColumn('customer_ids', array(
'header_css_class' => 'a-center',
'type' => 'checkbox',
'name' => 'customer_ids',
'values' => $this->_getSelectedCustomers(),
'align' => 'center',
'index' => 'entity_id'
));
$this->addColumn('position', array(
'header' => Mage::helper('catalog')->__('Position'),
'name' => 'position',
'type' => 'checkbox',
'validate_class' => 'validate-number',
'index' => 'position',
'values' => '',
));
Here is screenshot of output https://www.screencast.com/t/xCqsQ6NCF
I would also like to display label for column.
Please guide me on this.
asked Feb 13, 2017 at 6:04
MageLerner
5381 gold badge4 silver badges18 bronze badges
1 Answer 1
your data_callback is getSelectedCustomers
<data_callback>getSelectedCustomers</data_callback>
and you are calling
'values' => $this->_getSelectedCustomers(),
change it to
'values' => $this->getSelectedCustomers(),
answered Feb 13, 2017 at 6:21
Qaisar Satti
32.6k18 gold badges88 silver badges138 bronze badges
-
that is not the main point.i have two checkbox in one grid i want it work separately and post in form.currently it render disable when edit record.when i checked on first checkbox it also check all the second column checkbox too.MageLerner– MageLerner2017年02月13日 06:34:11 +00:00Commented Feb 13, 2017 at 6:34
-
@MageLerner you want to get post values of this gird? on based on that add some column?Qaisar Satti– Qaisar Satti2017年02月13日 06:40:44 +00:00Commented Feb 13, 2017 at 6:40
-
yes exactly i would like it work seperately both checkbox and postMageLerner– MageLerner2017年02月13日 06:42:26 +00:00Commented Feb 13, 2017 at 6:42
-
@MageLerner you can get grid values simply use this code
$this->getRequest()->getPost('customer')Qaisar Satti– Qaisar Satti2017年02月13日 06:46:30 +00:00Commented Feb 13, 2017 at 6:46 -
yes i can but second checkbox is not working correctly dearMageLerner– MageLerner2017年02月13日 06:55:30 +00:00Commented Feb 13, 2017 at 6:55
default