TV combobox width

Hello,

I have a tv as combobox. Is there a way to make dropdown in manager greater?

thank you in advance.

bye
chris

I believe the width of a listbox TV is defined here in the code (or for a listbox-multiple TV in the file /manager/templates/default/element/tv/renders/input/listbox-multiple.tpl).

You could change the width in this file but that’s not recommended (and the changes probably get overwritten on the next update).


Alternatively you could create a custom plugin that runs on the event OnResourceTVFormRender and change the value there. This event isn’t well documented but something like this may work:

<?php
// Only for use in the MODX manager
if ($modx->context->get('key') != 'mgr') {
	return;
}

// Enable event 'OnResourceTVFormRender'
$eventName = $modx->event->name;
if ($eventName == 'OnResourceTVFormRender') {
    foreach ($categories as $idc => $category) {
        foreach ($category['tvs'] as $idt => $tv) {
            if ($tv->type == 'listbox' || $tv->type == 'listbox-multiple') {
				$formElement = $categories[$idc]['tvs'][$idt]->formElement;
				$formElement = str_replace("width: 400","width: 800",$formElement); //change width to 800
				$categories[$idc]['tvs'][$idt]->set('formElement',$formElement);
            }
        }
    }
}

Hello,

thank you very much for your feedback and solution.

:pray:

bye
Chris