1

I am trying to display values in a column of a admin grid. The typical portion of code is as follows in _prepareColumns() in the class that extends Mage_Adminhtml_Block_Widget_Grid :

$this->addColumn(
    'destination',
    array(
        'type'   => 'options',
        'header' => Mage::helper('clothingcandy_customersort')->__('Customer Group Destination'),
        'width'  => '50px',
        'index'  => 'destination',
        'options'   => $optionarray,
    )
);   

While $optionarray contains most values, there might be one or two cases which is missing.

Is there a way to set a "default" label for the values that are not contained in $optionarray?

2 Answers 2

1

Changing the core files is a bad idea. Try to create a module that will override the core file. You can change the option array in the new module. And if label is not there in any field you can assign desired label.

1

You need to add default value at the first position in $optionarray,

Something like this.

<option><?php echo $this->__('Choose an Option...') ?></option>

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.