Browse Source

Merge pull request #1083 from rvignacio/default_ajax.transport

Added ajax.transport default option
Igor Vaynberg 12 years ago
parent
commit
a624417556
1 changed files with 8 additions and 3 deletions
  1. 8 3
      select2.js

+ 8 - 3
select2.js

@@ -355,7 +355,7 @@ the specific language governing permissions and limitations under the Apache Lic
                 var requestNumber = requestSequence, // this request's sequence number
                 var requestNumber = requestSequence, // this request's sequence number
                     data = options.data, // ajax data function
                     data = options.data, // ajax data function
                     url = ajaxUrl, // ajax url string or function
                     url = ajaxUrl, // ajax url string or function
-                    transport = options.transport || $.ajax,
+                    transport = options.transport,
                     type = options.type || 'GET', // set type of request (GET or POST)
                     type = options.type || 'GET', // set type of request (GET or POST)
                     params = {};
                     params = {};
 
 
@@ -731,7 +731,7 @@ the specific language governing permissions and limitations under the Apache Lic
                 });
                 });
             }
             }
 
 
-            opts = $.extend({}, {
+            opts = $.extend(true, {}, {
                 populateResults: function(container, results, query) {
                 populateResults: function(container, results, query) {
                     var populate,  data, result, children, id=this.opts.id, self=this;
                     var populate,  data, result, children, id=this.opts.id, self=this;
 
 
@@ -2754,7 +2754,12 @@ the specific language governing permissions and limitations under the Apache Lic
         blurOnChange: false,
         blurOnChange: false,
         selectOnBlur: false,
         selectOnBlur: false,
         adaptContainerCssClass: function(c) { return c; },
         adaptContainerCssClass: function(c) { return c; },
-        adaptDropdownCssClass: function(c) { return null; }
+        adaptDropdownCssClass: function(c) { return null; },
+        ajax: {
+            transport: function(options) {
+                return $.ajax(options);
+            }
+        }
     };
     };
 
 
     // exports
     // exports