IDEMPIERE-2935 New record on GridMode error on fields with DisplayLogic
This commit is contained in:
parent
cfa687b314
commit
641d918ebb
|
@ -861,4 +861,22 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
|
|||
Events.sendEvent(gridPanel, new Event("onSelectRow", gridPanel, checkBox));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the new value in the field, changes the display logic in the dependant fields
|
||||
* @param dependantFields
|
||||
*/
|
||||
public void checkDependants(ArrayList<GridField> dependantFields){
|
||||
|
||||
for ( GridField field : dependantFields ){
|
||||
|
||||
WEditor editor = editors.get(field);
|
||||
boolean isEditable = field.isEditableGrid(true);
|
||||
editor.setReadWrite(isEditable);
|
||||
if( isEditable )
|
||||
gridPanel.refresh(gridTab);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,11 +12,14 @@
|
|||
*****************************************************************************/
|
||||
package org.adempiere.webui.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.base.Core;
|
||||
import org.adempiere.exceptions.AdempiereException;
|
||||
import org.adempiere.webui.adwindow.GridTabRowRenderer;
|
||||
import org.adempiere.webui.component.Grid;
|
||||
import org.adempiere.webui.editor.WEditor;
|
||||
import org.adempiere.webui.event.ValueChangeEvent;
|
||||
import org.adempiere.webui.event.ValueChangeListener;
|
||||
|
@ -26,6 +29,7 @@ import org.compiere.model.GridTable;
|
|||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Trx;
|
||||
import org.zkoss.zul.RowRenderer;
|
||||
|
||||
/**
|
||||
* Transfer data from editor to GridTab
|
||||
|
@ -165,6 +169,28 @@ public class GridTabDataBinder implements ValueChangeListener {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Checks if the change in a field modifies the display logic in the dependant fields
|
||||
Object source = e.getSource();
|
||||
WEditor editor = (WEditor) source;
|
||||
|
||||
if( editor != null ){
|
||||
|
||||
ArrayList<GridField> dependants = gridTab.getDependantFields(editor.getColumnName());
|
||||
|
||||
if ( dependants != null && !dependants.isEmpty() )
|
||||
if( editor.getComponent() != null ) //Editor
|
||||
if( editor.getComponent().getParent() != null) //Cell
|
||||
if( editor.getComponent().getParent().getParent() != null ) //Row
|
||||
if( editor.getComponent().getParent().getParent().getParent() != null ) //Rows
|
||||
if( editor.getComponent().getParent().getParent().getParent().getParent() != null ){ //Grid
|
||||
Grid listBox = (Grid) editor.getComponent().getParent().getParent().getParent().getParent();
|
||||
RowRenderer<Object[]> renderer = listBox.getRowRenderer();
|
||||
GridTabRowRenderer gtr = (GridTabRowRenderer)renderer;
|
||||
gtr.checkDependants(dependants);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} // ValueChange
|
||||
|
||||
|
|
Loading…
Reference in New Issue