IDEMPIERE-377 Improve current search dialog box. Fixed can't search using invisible lookup field ( for e.g, CreatedBy and UpdatedBy ).

This commit is contained in:
Heng Sin Low 2012-10-23 06:48:06 +08:00
parent b0b209ce89
commit afb50f10e0
3 changed files with 46 additions and 21 deletions

View File

@ -178,9 +178,7 @@ public class GridField
m_vo.lookupInfo.DisplayType = DisplayType.Search;
}
//
m_vo.lookupInfo.IsKey = isKey();
MLookup ml = new MLookup (m_vo.lookupInfo, m_vo.TabNo);
m_lookup = ml;
loadLookupNoValidate();
}
else if (m_vo.displayType == DisplayType.Location) // not cached
{
@ -209,6 +207,21 @@ public class GridField
}
} // m_lookup
/***
* bypass isdisplay validation, used by findwindow
*/
public void loadLookupNoValidate() {
if (m_vo.lookupInfo == null) {
m_vo.loadLookupInfo();
}
if (m_vo.lookupInfo == null) {
return;
}
m_vo.lookupInfo.IsKey = isKey();
MLookup ml = new MLookup (m_vo.lookupInfo, m_vo.TabNo);
m_lookup = ml;
}
/**
* Wait until Load is complete
*/

View File

@ -582,6 +582,15 @@ public class GridFieldVO implements Serializable
// Create Lookup, if not ID
if (DisplayType.isLookup(displayType) && IsDisplayed)
{
loadLookupInfo();
}
} // initFinish
/**
* load lookup info.
* used by findwindow to loadlookupinfo for invisible field
*/
public void loadLookupInfo() {
try
{
lookupInfo = MLookupFactory.getLookupInfo (ctx, WindowNo, AD_Column_ID, displayType,
@ -598,7 +607,6 @@ public class GridFieldVO implements Serializable
displayType = DisplayType.ID;
}
}
} // initFinish
/**
* Clone Field.

View File

@ -1626,6 +1626,10 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
}
else
{
//lookupinfo is null for invisible field
if (DisplayType.isLookup(field.getDisplayType()) && field.getLookup() == null) {
field.loadLookupNoValidate();
}
editor = WebEditorFactory.getEditor(field, true);
}
if (editor == null)
@ -1634,8 +1638,8 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
field.addPropertyChangeListener(editor);
editor.addValueChangeListener(this);
editor.setValue(null);
editor.setReadWrite(enabled);
editor.setVisible(enabled);
editor.setReadWrite(true);
editor.setVisible(true);
editor.dynamicDisplay();
//
return editor.getComponent();