BUG 5648 Fixing restriction to multiple parent dependencie

- This commit change grid dropdown default options ommited
This commit is contained in:
Enrique Ponce De Leon
2011-06-02 11:10:20 -04:00
parent 435e187d5a
commit 90919d4f4b
2 changed files with 23 additions and 11 deletions

View File

@@ -416,6 +416,15 @@ var G_Grid = function(oForm, sGridName){
//aObjects[0].options.add(xOption); //aObjects[0].options.add(xOption);
oNewSelect.options.add(xOption); oNewSelect.options.add(xOption);
} }
}else{
//Copy all options
var oAux = document.createElement(aObjects[0].tagName);
for ( var j = 0; j < aObjects[0].options.length; j++) {
var oOption = document.createElement('OPTION');
oOption.value = aObjects[0].options[j].value;
oOption.text = aObjects[0].options[j].text;
oNewSelect.options.add(oOption);
}
} }
//TODO: Implement Default Value and Dependent Fields Trigger for grid dropdowns //TODO: Implement Default Value and Dependent Fields Trigger for grid dropdowns
} }
@@ -475,17 +484,20 @@ var G_Grid = function(oForm, sGridName){
var exist = false; var exist = false;
for (i=0; i < this.aFields.length; i++){ for (i=0; i < this.aFields.length; i++){
oAux = this.getElementByName(currentRow, this.aFields[i].sFieldName); oAux = this.getElementByName(currentRow, this.aFields[i].sFieldName);
if (oAux.dependentFields.length > 0){ if (typeof oAux !== 'undefined' && oAux != null)
exist = false; if (typeof oAux.dependentFields !== 'undefined'){
for (m=0; m < xIsDependentOf.length; m++) if (oAux.dependentFields.length > 0){
if (xIsDependentOf[m] == oAux.name) exist = true; exist = false;
for (j=0; j < oAux.dependentFields.length; j++){ for (m=0; m < xIsDependentOf.length; m++)
xIsDependentOf.push(oAux.dependentFields[j].name); if (xIsDependentOf[m] == oAux.name) exist = true;
for (j=0; j < oAux.dependentFields.length; j++){
xIsDependentOf.push(oAux.dependentFields[j].name);
}
if (!exist){
oAux.updateDepententFields();
}
}
} }
if (!exist){
oAux.updateDepententFields();
}
}
} }
//Fires OnAddRow Event //Fires OnAddRow Event
if (this.onaddrow) { if (this.onaddrow) {

View File

@@ -56,7 +56,7 @@
$G_FORM->id=urlDecode($_POST['form']); $G_FORM->id=urlDecode($_POST['form']);
//$G_FORM->values=isset($_SESSION[$G_FORM->id]) ? $_SESSION[$G_FORM->id] : array(); //$G_FORM->values=isset($_SESSION[$G_FORM->id]) ? $_SESSION[$G_FORM->id] : array();
$newValues=($json->decode(urlDecode(stripslashes($_POST['fields'])))); $newValues=($json->decode(urlDecode(stripslashes($_POST['fields']))));
$newValues = array_unique($newValues);
if (isset($_POST['grid'])) { if (isset($_POST['grid'])) {
$_POST['row'] = (int)$_POST['row']; $_POST['row'] = (int)$_POST['row'];
$aAux = array(); $aAux = array();