Class: LookupWidget

STX. LookupWidget


new LookupWidget(config)

This class is maintained for legacy implementations only (not using web components). New implementations should use functionality included in the web components (stxUI.js)
This is a widget that can be used to display search results

Parameters:
Name Type Description
config object

Configuration for widget

Properties
Name Type Description
stx object

the chart object

input object

DOM input field to attach the lookup widget

textCallback function

function to call when a search string is entered of format func(this, txt, filter)

selectCallback function

function to call when the user selects a search result or hits enter func(this, txt, filter)

filters array

an array of security classes to filter on. Valid values at this time for symbols are: ALL, STOCKS, FOREX, INDEXES. Null to not provide a filter.

cascade boolean

set to true to allow the lookup window to cascade on top of another window ( example: the comparison window in the advanced package).

mustSelect boolean

set to true to disable pressing enter in the input box. A selection from the list must occur.

allowSymbolObject boolean

set to true to return a symbol object from the search dropdown instead of just a symbol string. Please note that only if an item from the drop down is selected, can the corresponding object be returned. If the user enters text and presses enter or the add button, only that text will be returned as it is not derived from the dropdown list, wich contains the additional object information. See STXChart#newChart for details on how to use charts with a symbol object. @name STX.LookupWidget

Example
var config={
	input: $$$("#symbol"),						// input field from the GUI
	textCallback: textCallbackChartIQ,			// Function used to do lookup - If you don't have a symbol lookup then just leave this blank
	selectCallback: selectCallback,             // Function used to act on the symbol selected. Normally used to create a new chart with the new symbol.
	filters:["ALL","STOCKS","FUNDS","FOREX","INDEXES"],	// Names of the filters you are supporting
	allowSymbolObject : false,                   // set to true to return a symbol object from the search insted of just a symbol string
		    	stx: stxx									// the chart object -- needed for translations
};
var stxLookupWidget=new STX.LookupWidget(config);

Methods


close()

Closes the lookup results window


display()

Displays the lookup widget results. The lookup widget behaves like a menu. It will close if you click out of it or if you click on another menu.


displayResults(results)

Call this function with the results from your search.

Parameters:
Name Type Description
results object

Results to display on the dropdown. See Example for format.

Example
// Results should be an array of the following object:
{
		symbol: symbol,
		description: full name of security,
		exchange: optional exchange
}

init()

Initializes the lookup widget by attaching keyup and click events to the input. Also will start the chartIQ service if enabled.