Details
-
Type:
New Feature
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.0
-
Fix Version/s: 1.2
-
Component/s: None
-
Labels:None
Description
For autoComplete (and possibly datatable), I'd like a better control of the data source. ideally, it should support any or all of the following:
- allow me to pass in a data source as a JavaScript reference
- a builder/map to define the dataSource
- a tag to define a datasource
why I want to do so? is the current implementation flexible enough to handle any requirement?
- In autoComplete, I want to configure the dataURL by a String instead of controller+action.
- In autoComplete, I want to use a TYPE_JSON response type instead of an Array response
- by principle, it's better to support customization of any JavaScript component
- reuse of data source (?possibly need a use case?)
- using any data source features, e.g. type conversion
attached is a Utils / Category that could convert a Map to a piece of JavaScript. Refer to the method comment for the spec.
As demonstration, it converts the following Map:
def dataSource = [var: 'oDS', 'class': 'YAHOO.util.XHRDataSource', args: ['assets/php/ysearch_flat.php'], call: [['responseType': '$YAHOO.util.XHRDataSource.TYPE_TEXT ', 'responseSchema': [recordDelim: '\n', fieldDelim: '\t']], ['flushCache'], ['maxCacheEntries': 5]]]to the following JavaScript String:
(modified base on the data source at : http://developer.yahoo.com/yui/examples/autocomplete/ac_basic_xhr_clean.html )
def dataSource = [var: 'oDS', 'class': 'YAHOO.util.XHRDataSource', args: ['assets/php/ysearch_flat.php'], call: [['responseType': '$YAHOO.util.XHRDataSource.TYPE_TEXT ', 'responseSchema': [recordDelim: '\n', fieldDelim: '\t']], ['flushCache'], ['maxCacheEntries': 5]]]