Custom dashlet field widht

I have created custom module and want to use its dashlet on homepage. I am able to change width of “original” mandatory fields (name, assigned_user_id) fields via Studio, but any change on custom module field not apply on dashlet list view.

Please help,

Michal

Hi Michal,

How are you changing the size? Via studio? Do you get any JavaScript errors when trying to save?

Thanks,

Will.

I’ve found solution. Problem is in DashletGeneric.php. There is static value for dashlet listview field width = 10 in function addCustomFields :

function addCustomFields() {
    foreach($this->seedBean->field_defs as $fieldName => $def) {
        if(!empty($def['type']) && $def['type'] == 'html')
            continue;
        if(isset($def['vname'])) {
            $translated = translate($def['vname'], $this->seedBean->module_dir);
            if(is_array($translated)) $translated = $def['vname'];
            if(!empty($def['source']) && $def['source'] == 'custom_fields') {
            	if(isset($this->columns[$fieldName]['default']) && $this->columns[$fieldName]['default']){
            		$this->columns[$fieldName] = array([color=#ff0000]'width' => '10',[/color]
                                                   'label' => $translated,
                                                   'default' => 1);
            	}else{
                $this->columns[$fieldName] = array([color=#ff0000]'width' => '10',[/color]
                                                   'label' => $translated);
            	}

            }
        }
    }
}

Fix:

‘width’ =>[color=#ff0000]$this->columns$fieldName[/color] // just change bracket as it cannot be shown in forum chat correctly

Hope it helps.

Michal