Index: col_picker_helper.php =================================================================== --- col_picker_helper.php (revision 14239) +++ col_picker_helper.php (working copy) @@ -21,6 +21,13 @@ var $UseFreezer; /** + * Default column width in pixels + * + * @var int + */ + var $defaultColumnWidth = 100; + + /** * Columns renamed by formatter in last used grid * * @var Array @@ -128,7 +135,7 @@ } foreach($common as $col) { - $cols['widths'][$col] = isset($current['widths'][$col]) ? $current['widths'][$col] : 100; + $cols['widths'][$col] = isset($current['widths'][$col]) ? $current['widths'][$col] : $this->defaultColumnWidth; } $this->SetCRC($cols); } @@ -191,11 +198,12 @@ $fields[$counter] = $name; $titles[$name] = $options['title']; - $widths[$name] = array_key_exists('width', $options) ? $options['width'] : 100; // only once per grid ! - if (isset($options['hidden']) && $options['hidden']) - { + $widths[$name] = isset($options['width']) ? $options['width'] : $this->defaultColumnWidth; // only once per grid ! + + if (isset($options['hidden']) && $options['hidden']) { $hidden[$counter] = $name; } + $counter++; } $sorted_fields = $fields; @@ -257,13 +265,22 @@ function SaveWidths($prefix, $widths) { - if (!is_array($widths)) $widths = explode(':', $widths); + if (!is_array($widths)) { + $widths = explode(':', $widths); + } + + $i = 0; array_shift($widths); // removing first col (checkbox col) width - $i = 0; + foreach ($this->PickerData['order'] as $ord => $field) { - if ($field == '__FREEZER__') continue; - $this->PickerData['widths'][$field] = $widths[$i++]; + if ($field == '__FREEZER__') { + continue; + } + + $this->PickerData['widths'][$field] = isset($widths[$i]) ? $widths[$i] : $this->defaultColumnWidth; + $i++; } + $this->StoreCols($prefix, $this->PickerData); }