I have this form
I can do the sort in the top table, but I can not do in the bottom. How to make it possible to sort immediately in 2 tables?
code on form.php
protected function _prepareForm()
{
$form = new Varien_Data_Form(array(
"id" => "edit_form",
"action" => $this->getUrl("*/*/addhdd"),
"method" => "post",
));
$this->setForm($form);
$arrayResults = Mage::registry('arrayResults');
$fieldset = $form->addFieldset("hdd_form");
$fieldset->addType('customer_grid', 'DaniilKrok_Testing_Block_Adminhtml_Testing_Hdd_Form_Renderer_Fieldset_Customergrid');
$fieldset->addType('customer_grid_pcb', 'DaniilKrok_Testing_Block_Adminhtml_Testing_Hdd_Form_Renderer_Fieldset_Customerpcb');
$fieldset->addField('table_id', 'customer_grid', array(
'label' => Mage::helper('customer')->__('Purchase Wizard Table'),
'class' => 'required-entry',
'name' => 'table_id',
'onchange' => "",
'disabled' => false,
'readonly' => false,
'tabindex' => 1,
));
$fieldset->addField('serial_number', 'text', array(
'label' => Mage::helper('testing')->__('Serial Number'),
'required' => true,
'name' => 'serial_number',
'disabled' => false,
'tabindex' => 1,
));
$fieldset->addField('test_result', 'select', array(
'label' => Mage::helper('testing')->__('Test Result'),
'required' => true,
'tabindex' => 1,
'name' => 'test_result',
'options' => $arrayResults
));
$fieldset->addField('lot_id', 'text', array(
'label' => Mage::helper('testing')->__('Lot id'),
'name' => 'lot_id',
'disabled' => false,
'tabindex' => 1,
));
// $fieldset->addField('revision', 'text', array(
// 'label' => Mage::helper('testing')->__('Revision'),
// 'tabindex' => 1,
// 'name' => 'revision',
// ));
//
//
// $fieldset->addField('controller_chip', 'text', array(
// 'label' => Mage::helper('testing')->__('Controller chip'),
// 'tabindex' => 1,
// 'name' => 'controller_chip',
// ));
$fieldset->addField('pcb_id', 'customer_grid_pcb', array(
'label' => Mage::helper('customer')->__('Customer PCB SKU table'),
'class' => 'required-entry',
'name' => 'pcb_id',
'onchange' => "",
'disabled' => false,
'readonly' => false,
'tabindex' => 1,
));
$fieldset->addField('purchasewizard_id', 'hidden', array(
'name' => 'purchasewizard_id',
'class' => 'purchasewizard_id'
));
$form->setUseContainer(true);
return parent::_prepareForm();
}
code on customerpcb.php
< ?php
class DaniilKrok_Testing_Block_Adminhtml_Testing_Hdd_Form_Renderer_Fieldset_Customerpcb extends Varien_Data_Form_Element_Abstract{
protected $_element;
public function getElementHtml()
{
return Mage::helper('core')->getLayout()->createBlock('testing/adminhtml_testing_hdd_form_renderer_fieldset_customer_gridpcb')->toHtml();
}
}
code on customergrid.php
< ?php
class DaniilKrok_Testing_Block_Adminhtml_Testing_Hdd_Form_Renderer_Fieldset_Customergrid extends Varien_Data_Form_Element_Abstract{
protected $_element;
public function getElementHtml()
{
return Mage::helper('core')->getLayout()->createBlock('testing/adminhtml_testing_hdd_form_renderer_fieldset_customer_grid')->toHtml();
}
}
code on gridpcb.php
class DaniilKrok_Testing_Block_Adminhtml_Testing_Hdd_Form_Renderer_Fieldset_Customer_Gridpcb extends Mage_Adminhtml_Block_Widget_Grid
{
public function __construct()
{
parent::__construct();
$this->setId('customerGrid');
$this->setDefaultSort('entity_id');
}
protected function _prepareCollection()
{
$collection = Mage::getModel('listingwizard/listingtemplate')->getCollection();
$this->setCollection($collection);
return parent::_prepareCollection();
}
protected function _prepareColumns()
{
$this->addColumn("revision", array(
"header" => Mage::helper("listingwizard")->__("PCB Revision"),
"index" => "revision"
));
$this->addColumn("controllerchip", array(
"header" => Mage::helper("listingwizard")->__("Controller Chip"),
"index" => "controllerchip"
));
return parent::_prepareColumns();
}
protected function _prepareMassaction()
{
$this->setMassactionIdField('id');
$this->getMassactionBlock()->setFormFieldName('pcb_ids');
return $this;
}
}
code on grid.php
class DaniilKrok_Testing_Block_Adminhtml_Testing_Hdd_Form_Renderer_Fieldset_Customer_Grid extends Mage_Adminhtml_Block_Widget_Grid
{
public function __construct()
{
parent::__construct();
$this->setId('customerGrid');
$this->setDefaultSort('entity_id');
}
protected function _prepareCollection()
{
$collection = Mage::getModel("purchasewizard/groupdata")->getCollection();
$this->setCollection($collection);
return parent::_prepareCollection();
}
protected function _prepareColumns()
{
$this->addColumn("id", array(
"header" => Mage::helper("purchasewizard")->__("Id"),
"index" => "id",
"column_css_class" => "id",
));
$this->addColumn("model", array(
"header" => Mage::helper("purchasewizard")->__("Model"),
"index" => "model",
"width" => "300px",
'column_css_class' => 'model_dynamic_class'
));
$this->addColumn("pn_hddcode_2ndmodel", array(
"header" => Mage::helper("purchasewizard")->__("Spec 1"),
"index" => "pn_hddcode_2ndmodel",
"width" => "300px",
'column_css_class' => 'spec_1_dynamic_class'
));
$this->addColumn("mlc_fw_sitecode_dcm", array(
"header" => Mage::helper("purchasewizard")->__("Spec 2"),
"index" => "mlc_fw_sitecode_dcm",
"width" => "300px",
'column_css_class' => 'spec_2_dynamic_class'
));
$this->addColumn("spec_3", array(
"header" => Mage::helper("purchasewizard")->__("Spec 3"),
"index" => "spec_3",
"width" => "300px",
'column_css_class' => 'spec_3_dynamic_class'
));
$this->addColumn("spec_4", array(
"header" => Mage::helper("purchasewizard")->__("Spec 4"),
"index" => "spec_4",
"width" => "300px",
'column_css_class' => 'spec_4_dynamic_class'
));
return parent::_prepareColumns();
}
protected function _prepareMassaction()
{
$this->setMassactionIdField('id');
$this->getMassactionBlock()->setFormFieldName('ids');
$this->getMassactionBlock()->addItem('refresh', array(
'label'=> Mage::helper('purchasewizard')->__('Refresh')
));
return $this;
}
}