Skip to content

Loading…

Allow to change options of running instance #48

Open
wants to merge 1 commit into from

2 participants

@doits

This way, all options can be changed dynamically even after initializing

@doits doits Allow to change options of running instance
This way, all options can be changed dynamically even after initializing
250cadc
@CoolCookie

Can you show an example how to change the URL parameters dynamically?

// use url1 als default
url1 = 'test1.php';

// use url2 on request
url2 = 'test2.php';

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 3, 2012
  1. @doits

    Allow to change options of running instance

    doits committed
    This way, all options can be changed dynamically even after initializing
Showing with 12 additions and 0 deletions.
  1. +12 −0 src/jquery.autocomplete.js
View
12 src/jquery.autocomplete.js
@@ -602,6 +602,18 @@
};
/**
+ * Change options of an instance
+ * @param {object} opts Object with the new options, e.g. {url: "/new/url/"}
+ * @public
+ */
+ $.Autocompleter.prototype.setOptions = function(opts) {
+ var key;
+ for (key in opts) {
+ this.options[key] = opts[key];
+ }
+ };
+
+ /**
* Build the url for a remote request
* If options.queryParamName === false, append query to url instead of using a GET parameter
* @param {string} param The value parameter to pass to the backend
Something went wrong with that request. Please try again.