# Yahoo! UI Library

### AutoComplete Widget 2.2.2

Yahoo! UI Library > autocomplete > YAHOO.widget.DS_JSFunction

## Class YAHOO.widget.DS_JSFunction - extends YAHOO.widget.DataSource

Implementation of YAHOO.widget.DataSource using a native Javascript function as its live data source.

### Constructor

YAHOO.widget.DS_JSFunction `( oFunction , oConfigs )`

Parameters:
  `oFunction <HTMLFunction>` In-memory Javascript function that returns query results as an array of objects.
  `oConfigs <Object>` (optional) Object literal of config params.

### Properties

#### dataFunction `- HTMLFunction`

In-memory Javascript function that returns query results.

#### Properties inherited from YAHOO.widget.DataSource:

`_aCache, _sName, maxCacheEntries, queryMatchCase, queryMatchContains, queryMatchSubset`

### Methods

#### doQuery

`void doQuery ( oCallbackFn , sQuery , oParent )`
Queries the live data source defined by function for results. Results are passed back to a callback function.

Parameters:
  `oCallbackFn <HTMLFunction>` Callback function defined by oParent object to which to return results.
  `sQuery <String>` Query string.
  `oParent <Object>` The object instance that has requested data.

Returns: `void`

#### Methods inherited from YAHOO.widget.DataSource:

`_addCacheElem, _doQueryCache, _init, doQuery, flushCache, getResults, toString`

#### Events inherited from YAHOO.widget.DataSource:

`cacheFlushEvent, cacheQueryEvent, dataErrorEvent, getCachedResultsEvent, getResultsEvent, queryEvent`

Copyright © 2007 Yahoo! Inc. All rights reserved.