BUGFIX Using objects rather than arrays for TreeDropdownField ajax search params, fixed selectors stuffed up in e385bbcb

This commit is contained in:
Ingo Schommer 2012-01-02 22:38:13 +01:00
parent c0fddf262c
commit 4baef3b892

View File

@ -114,7 +114,7 @@
}, },
loadTree: function(params, callback) { loadTree: function(params, callback) {
var self = this, panel = this.getPanel(), treeHolder = $(panel).find('.tree-holder'); var self = this, panel = this.getPanel(), treeHolder = $(panel).find('.tree-holder');
var params = (params) ? this.getRequestParams().concat(params) : this.getRequestParams(); var params = (params) ? $.extend({}, this.getRequestParams(), params) : this.getRequestParams();
panel.addClass('loading'); panel.addClass('loading');
treeHolder.load(this.data('url-tree'), params, function(html, status, xhr) { treeHolder.load(this.data('url-tree'), params, function(html, status, xhr) {
var firstLoad = true; var firstLoad = true;
@ -181,10 +181,10 @@
* This is useful to keep state like locale values which are typically * This is useful to keep state like locale values which are typically
* encoded in hidden fields through the form. * encoded in hidden fields through the form.
* *
* @return {array} * @return {object}
*/ */
getRequestParams: function() { getRequestParams: function() {
return []; return {};
} }
}); });
@ -220,7 +220,7 @@
this._super(); this._super();
var title = this.data('title'); var title = this.data('title');
this.find('.title').replaceWith( this.find('.treedropdownfield-title').replaceWith(
$('<input type="text" class="treedropdownfield-title search" />') $('<input type="text" class="treedropdownfield-title search" />')
); );
@ -269,7 +269,7 @@
}, },
loadTree: function(params, callback) { loadTree: function(params, callback) {
var self = this, panel = this.getPanel(), treeHolder = $(panel).find('.tree-holder'); var self = this, panel = this.getPanel(), treeHolder = $(panel).find('.tree-holder');
var params = (params) ? this.getRequestParams().concat(params) : this.getRequestParams(); var params = (params) ? $.extend({}, this.getRequestParams(), params) : this.getRequestParams();
panel.addClass('loading'); panel.addClass('loading');
treeHolder.load(this.data('url-tree'), params, function(html, status, xhr) { treeHolder.load(this.data('url-tree'), params, function(html, status, xhr) {
var firstLoad = true; var firstLoad = true;