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
|
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.