Skip to content

Instantly share code, notes, and snippets.

@ttdonovan
Created April 7, 2009 17:35
Show Gist options
  • Select an option

  • Save ttdonovan/91349 to your computer and use it in GitHub Desktop.

Select an option

Save ttdonovan/91349 to your computer and use it in GitHub Desktop.
CDWeb.ObjectSelectorFieldView = SC.View.extend(
/** @scope CDWeb.ObjectSelectorFieldView.prototype */{
requestUrlBinding: 'CDWeb.objectSelectorController.requestUrl',
requestParamsBinding: 'CDWeb.objectSelectorController.requestParams',
render: function(context, firstTime) {
if (firstTime) {
context.push('<input type="text" style="width:100%" />') ;
}
},
didCreateLayer: function() {
$(this.$('input')[0]).autocomplete(null, { ... }) ;
},
requestUrlOrParamsHasChangedObserver: function() {
// update autocomplete url & extraParams
$(this.$('input')[0]).setOptions({
url: this.get('requestUrl'),
extraParams: this.get('requestParams')
}) ;
}.observes('requestUrl', 'requestParams')
}) ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment