Created
December 7, 2010 13:53
-
-
Save augustine-tran/731799 to your computer and use it in GitHub Desktop.
replace arguments by hack to add empty params.filters to request for buildUrl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* We need to add a little processing to the normal buildRequest. In YQL we send an SQL-like | |
* query statement - in this case using the search query above. To honor the filters applied | |
* by the user, we pull those out in this function and apply them to the search XTemplate. | |
* Finally, we modify the url to add this generated query and any other required parameters. | |
*/ | |
buildRequest: function(operation) { | |
var hack = Ext.apply({params: {filters: []}}, arguments); | |
var request = Ext.data.KivaProxy.superclass.buildRequest.apply(this, [hack]), | |
queryTpl = this.queries.search, | |
filters = operation.filters || [], | |
filterData = {}; | |
Ext.iterate(filters, function(filter) { | |
filterData[filter.property] = filter.value; | |
}); | |
delete request.params.filters; | |
Ext.applyIf(request.params, { | |
format: 'json', | |
q: queryTpl.applyTemplate(filterData) | |
}); | |
request.url = Ext.urlAppend(request.url, Ext.urlEncode(request.params)); | |
return request; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment