YfcShowSearchPopup

Description

This function invokes the specified search view in a pop-up window. This function can be used to display lookup results.

Syntax

yfcShowSearchPopup(viewID, name, width, height, argument, entity)

Input parameters

viewID - Required. Resource ID of the search view to be shown as a pop-up window. If passed as an empty string, the default detail view of the specified entity is displayed.

name - Required. Pass as a blank space (" "). Not used.

width - Required. Horizontal size of the pop-up window. Measured in pixels. If passed as 0, a certain default width is used.

height - Required. Vertical size of the pop-up window. Measured in pixels. If passed as 0, a certain default height is used.

argument - Required. Value passed as the argument parameter to the showModalDialog() function that is used to show the pop-up window. This then becomes available in the modal dialog through the window.dialogArguments attribute.

entity - Optional. Resource ID corresponding to the entity being searched for. If not passed, defaults to the name of the current entity.

Return value

None.

Example

This example shows how to invoke a single field lookup. The callLookup() function invokes a search pop-up window.

From the search pop-up window, when the user selects a row, the setLookupValue() function is called with the selected value as a parameter.

The setLookupValue() function populates the value in the text field and closes the lookup search window.

function setLookupValue(sVal) 
{
   var Obj=window.dialogArguments
   if(Obj != null)
      Obj.field1.value=sVal;
   window.close(); 
}
//obj is to be passed as "this", 
// which would be the icon that was selected for lookup. 
//This function assumes that the lookup icon is placed 
// immediately after the text field on which lookup is requested. 
//entityname is the entity name of the search view 
// that needs to be shown in the lookup. 
function callLookup(obj,entityname) 
{
		var oObj=new Object();
		var oField=obj.previousSibling;
		while(oField != null && oField.type != "text" && oField.type != "TEXT")
		{
			oField=oField.previousSibling;
		}
		oObj.field1=oField;
		yfcShowSearchPopup('','lookup',900,550,oObj,entityname); 
}