From d95f8679458470b7d53c8f890c3fc500411f5134 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sat, 21 Nov 2009 02:31:47 +0000 Subject: [PATCH] ENHANCEMENT Triggering jQuery events in TreeSelectorField.js in preparation to switching the tree logic to jQuery. This prevents developers from using the soon-to-be-deprecated Observable prototype git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@92541 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- forms/TreeSelectorField.php | 1 + javascript/TreeSelectorField.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/forms/TreeSelectorField.php b/forms/TreeSelectorField.php index 75a4161f9..bfbd3d94c 100755 --- a/forms/TreeSelectorField.php +++ b/forms/TreeSelectorField.php @@ -18,6 +18,7 @@ class TreeSelectorField extends FormField { Requirements::javascript(THIRDPARTY_DIR . "/prototype_improvements.js"); Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang'); + Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/jquery/jquery.js"); Requirements::javascript(SAPPHIRE_DIR . "/javascript/TreeSelectorField.js"); $fieldName = $this->name; diff --git a/javascript/TreeSelectorField.js b/javascript/TreeSelectorField.js index 8d7b5fec9..cec8109fe 100755 --- a/javascript/TreeSelectorField.js +++ b/javascript/TreeSelectorField.js @@ -208,6 +208,7 @@ TreeDropdownField.prototype = { if(this.inputTag.value != val) { this.inputTag.value = val; + jQuery(this).trigger('ss.TreeDropdownField.change', {val: val}); this.notify('Change', val); // If the tree item is already downloaded, just update the label @@ -240,6 +241,7 @@ TreeDropdownField.prototype = { setValueFromTree: function(treeID, title) { this.humanItems.innerHTML = title; this.inputTag.value = treeID.replace('selector-' + this.getName() + '-',''); + jQuery(this).trigger('ss.TreeDropdownField.change', {val: this.inputTag.value}); this.notify('Change', this.inputTag.value); this.hideTree();