IDEMPIERE-107 Value from embedded tab remain as part of window context after user have navigated to next header record that have zero record in the embedded tab.

(transplanted from dae710b3ee372a9b46a90c7f42a4286ae31c3009)
This commit is contained in:
Heng Sin Low 2011-12-14 19:39:27 +08:00
parent 2bac002db4
commit 45b0d10efe
2 changed files with 35 additions and 1 deletions

View File

@ -709,6 +709,25 @@ public class GridController extends CPanel
{
// start loading while building screen
m_mTab.query(onlyCurrentRows, onlyCurrentDays, maxRows);
//make sure value from previous query is clear from window context
if (m_mTab.getRowCount() == 0)
{
if (getGCParent() != null)
{
ArrayList<String> parentColumnNames = new ArrayList<String>();
GridField[] parentFields = getGCParent().getMTab().getFields();
for (GridField parentField : parentFields)
parentColumnNames.add(parentField.getColumnName());
GridField[] fields = m_mTab.getFields();
for (GridField field : fields)
{
if (!parentColumnNames.contains(field.getColumnName()))
Env.setContext(Env.getCtx(), field.getWindowNo(), field.getColumnName(), "");
}
}
}
// Update UI
if (!isSingleRow())
vTable.autoSize(true);

View File

@ -908,10 +908,25 @@ DataStatusListener, IADTabpanel, VetoableChangeListener
}
if (!includedPanel.isEmpty() && e.getChangedColumn() == -1) {
ArrayList<String> parentColumnNames = new ArrayList<String>();
GridField[] parentFields = gridTab.getFields();
for (GridField parentField : parentFields)
parentColumnNames.add(parentField.getColumnName());
for (EmbeddedPanel panel : includedPanel)
{
GridTab tab = panel.tabPanel.getGridTab();
GridField[] fields = tab.getFields();
for (GridField field : fields)
{
if (!parentColumnNames.contains(field.getColumnName()))
Env.setContext(Env.getCtx(), field.getWindowNo(), field.getColumnName(), "");
}
panel.tabPanel.query(false, 0, 0);
}
parentColumnNames = null;
}
}
private void deleteNode(int recordId) {