BUG 6914 Fix Bug Adjust change width in details grids.

This commit is contained in:
Hector Cortez
2011-06-15 16:56:01 -04:00
parent c6a66082c9
commit dd82f65667

View File

@@ -3009,8 +3009,9 @@ class XmlForm_Field_Grid extends XmlForm_Field
*/ */
function render($values, $owner = NULL){ function render($values, $owner = NULL){
$arrayKeys = array_keys ( $this->fields ); $arrayKeys = array_keys ( $this->fields );
$emptyRow = array (); $emptyRow = array ();
$fieldsSize = 0;
foreach ( $arrayKeys as $key ){ foreach ( $arrayKeys as $key ){
if (isset($this->fields[$key]->defaultValue)){ if (isset($this->fields[$key]->defaultValue)){
$emptyValue = $this->fields[$key]->defaultValue; $emptyValue = $this->fields[$key]->defaultValue;
@@ -3023,8 +3024,15 @@ class XmlForm_Field_Grid extends XmlForm_Field
$emptyValue = ''; $emptyValue = '';
} }
$size = $this->fields[$key]->size;
if(!isset($size)) $size = 15;
$fieldsSize += $size;
$emptyRow [$key] = array ($emptyValue); $emptyRow [$key] = array ($emptyValue);
} }
if($fieldsSize>100)
$owner->width = '100%';
else
$owner->width = $fieldsSize . 'em';
return $this->renderGrid ( $emptyRow, $owner ); return $this->renderGrid ( $emptyRow, $owner );