diff --git a/gulliver/js/grid/core/grid.js b/gulliver/js/grid/core/grid.js index 14b42b873..c1d8a1341 100755 --- a/gulliver/js/grid/core/grid.js +++ b/gulliver/js/grid/core/grid.js @@ -681,17 +681,20 @@ var G_Grid = function(oForm, sGridName){ } } } + + //Set focus the first element in the grid + for (var i = 0; i < this.aFields.length; i++) { + var fieldName = 'form[' + sGridName + '][' + currentRow + '][' + this.aFields[i].sFieldName + ']'; + if (this.aFields[i].sType != 'file' && document.getElementById(fieldName).focus) { + document.getElementById(fieldName).focus(); + break; + } + } + //Fires OnAddRow Event if (this.onaddrow) { this.onaddrow(currentRow); } - var newInputs = oNewRow.getElementsByTagName('input'); - for (var i = 0; i < newInputs.length; i++) { - if (typeof(newInputs[i]) != 'undefined' && newInputs[i].type != 'hidden') { - newInputs[i].focus(); - break; - } - } }; this.deleteGridRow = function (sRow, bWithoutConfirm) @@ -740,12 +743,12 @@ var G_Grid = function(oForm, sGridName){ for (i = 1; i < oObj.oGrid.rows[iRowAux - 1].cells.length; i++) { var oCell1 = oObj.oGrid.rows[iRowAux - 1].cells[i]; var oCell2 = oObj.oGrid.rows[iRowAux].cells[i]; - + switch (oCell1.innerHTML.replace(/^\s+|\s+$/g, '').substr(0, 6).toLowerCase()){ case 'values [$k] )) ? $form->values [$k] : NULL; $result [$k] = G::replaceDataField ( $form->fields [$k]->label, $form->values ); if ($form->type == 'xmlform') { - if ($v->type == 'checkgroup' || $v->type == 'radiogroup') { - $firstValueOptions = ''; - foreach ($v->options as $indexOption => $valueOptions) { - $firstValueOptions = $indexOption; - break; - } - if ($firstValueOptions != '') { - $result[$k] = ''; - } else { - $result[$k] = ''; - } - } else { + if ($v->type != 'checkgroup' && $v->type != 'radiogroup') { $result[$k] = ''; + } else { + if (is_array($v->options)) { + foreach ($v->options as $optionValue => $optionLabel) { + if (isset($form->fields[$k]->options[$optionValue])) { + $form->fields[$k]->options[$optionValue] = ''; + } + } + } } } if (! is_array ( $value )) {