1

I have created a custom configuration same like Magento\Braintree\Block\Adminhtml\Form\Field\Countrycreditcard.php with some fields like

$this->addColumn(
            'field',
            ['label' => __('Field'), 'renderer' => $this->_getAttributesRenderer(),'style' => 'width: 1000px']
        );

Even if i set width in style its not working.

Please let me know how to set width.

1
  • @Marius Did you get the chance to look on this Commented Feb 11, 2016 at 13:15

2 Answers 2

2

In

Magento\Braintree\Block\Adminhtml\Form\Field\Cctypes.php` `_toHtml

has

$this->setExtraParams('multiple="multiple"');

So with same function try to set width

setExtraParams('style="width:1000px;"');

setExtraParams function accepts any styling or other attributes we can set for select field

0

I was using this Magento\Framework\Data\Form\Element\Factory class to generate element and I've added below code and it worked for me.

$element = $this->_elementFactory->create('select');
$regions = $this->regionOptions->toOptionArray();
        $element->setForm(
            $this->getForm()
        )->setName(
            $this->_getCellInputElementName($columnName)
        )->setHtmlId(
            $this->_getCellInputElementId('<%- _id %>', $columnName)
        )->setValues(
            $regions
        )->setStyle('width:200px;');

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.