我可以在Magento Admin Grid Mass Action中显示两个方框,还是在行动前选择一个日期?

时间:2016-06-09 10:56:02

标签: php magento datetime datepicker admin

我创建了一个Magento Admin Grid并使用Mass Action来设置开始和结束日期。

现在,我的群众行动按照dropdown list中的选择运行,选择开始或停止datepicker框将在选择第一个框后显示。

我可以在dropdown list之前同时显示两个方框(datepickerselect date)或dropdown list吗?

我的代码:

$this->getMassactionBlock()->addItem('setstartdate', array(
    'label' => $this->__('Set Start Date'),
    'url' => $this->getUrl('*/*/massSetstartdate', array('' => '')), 
    'confirm' => $this->__('Are you sure?'),
    'additional' => array(
        'setstartdate' => array(
            'name'   => 'setstartdate',
            'time'   => true,
            'input'  => 'datetime',
            'type'   => 'datetime',
            'class'  => 'required-entry',
            'label'  => Mage::helper('setcustomdate')->__('Set start Date'),
            // 'gmtoffset' => true,
            'image'  => '/skin/adminhtml/default/default/images/grid-cal.gif',
            'format' => 'yyyy-MM-dd H:mm:ss'
        )
    )
));

$this->getMassactionBlock()->addItem('setstopdate', array(
    'label' => $this->__('Set Stop Date'),
    'url' => $this->getUrl('*/*/massSetstopdate', array('' => '')), 
    'confirm' => $this->__('Are you sure?'),
    'additional' => array(
        'setstopdate' => array(
            'name'   => 'setstopdate',
            'time'   => true,
            'input'  => 'datetime',
            'type'   => 'datetime',
            'class'  => 'required-entry',
            'label'  => Mage::helper('setcustomdate')->__('Set Stop Date'),
            // 'gmtoffset' => true,
            'image'  => '/skin/adminhtml/default/default/images/grid-cal.gif',
            'format' => 'yyyy-MM-dd H:mm:ss'
        )
    )
));

修改1 更新prepareColumns

protected function _prepareColumns() {
    $helper = Mage::helper('setupdate'); 

    $this->addColumn('data_id', array(
        'header' => $helper->__('Data No.'),
        'index'  => 'data_id'
    )); 

    $this->addColumn('startdate', array(
        'header'=> $helper->__('Start'),// store
        'index' => 'startdate',
        'filter_index' => 't1.start_date',
        'format' => 'F', 
        'type' => 'datetime', 
    ));

    $this->addColumn('stopdate', array(
        'header'=> $helper->__('Stop'),// store
        'index' => 'stopdate',
        'filter_index' => 't1.stop_date',
        'format' => 'F', 
        'type' => 'datetime', 
    ));

    return parent::_prepareColumns();
}

0 个答案:

没有答案