Skip to content
This repository
Browse code

BUGFIX Use tree/xxx instead of tree?ID=xxx when fetching subtrees for…

… TreeDropdownField. Fix #7730
  • Loading branch information...
commit fb9e997b5e22ec8518967c69007632b8e5e90071 1 parent c28c024
Jean-Fabien authored August 01, 2012 wilr committed August 04, 2012

Showing 1 changed file with 5 additions and 3 deletions. Show diff stats Hide diff stats

  1. 8  javascript/TreeDropdownField.js
8  javascript/TreeDropdownField.js
@@ -192,10 +192,12 @@
192 192
 						// TODO Hack to avoid ajax load on init, see http://code.google.com/p/jstree/issues/detail?id=911
193 193
 						'data': this.getPanel().find('.tree-holder').html(),
194 194
 						'ajax': {
195  
-							'url': this.data('urlTree'),
  195
+							'url': function(node) {
  196
+								return self.data('urlTree') + '/' + ($(node).data("id") ? $(node).data("id") : 0);
  197
+							},
196 198
 							'data': function(node) {
197  
-								var id = $(node).data("id") ? $(node).data("id") : 0, params = self.getRequestParams();
198  
-								params = $.extend({}, params, {ID: id, ajax: 1});
  199
+								var params = self.getRequestParams();
  200
+								params = $.extend({}, params, {ajax: 1});
199 201
 								return params;
200 202
 							}
201 203
 						}

4 notes on commit fb9e997

Damian Mooyman
Collaborator

I have a small issue where this would break the translatable module. The resulting code would try to request a url similar to the below:

/admin/pages/EditorToolbar/LinkForm/field/internal/tree?locale=en_NZ/21&ajax=1

I'd issue a pull request if I knew how to submit more than one at once on Github. :)

Will Rossiter
Collaborator

@tractorcow use branches for each pull request. E.g I have sapphire/fix-1234, sapphire/fix-foobar then you can submit as many pull requests as you want from different branches. Once the branch has been merged, then simply delete it.

Damian Mooyman
Collaborator

Thanks for the advice Will. It has helped me become a better community member. :)

Damian Mooyman
Collaborator

I've added my fix in a80daef. Thank you for your help.

Please sign in to comment.
Something went wrong with that request. Please try again.