MDL-51957 cbe: Use a jquery 'change' event instead of passing callbacks

This commit is contained in:
Damyon Wiese 2015-10-29 12:58:34 +08:00 committed by Frederic Massart
parent 60bf8bb0aa
commit 85dbaf91ba
9 changed files with 27 additions and 23 deletions

View file

@ -41,8 +41,8 @@
<button>{{#pix}}a/search, , {{#str}}search{{/str}}{{/pix}}</button>
</form>
</p>
<div data-enhance="tree">
</div>
<ul data-enhance="tree">
</ul>
</div>
<div class="span6 well">
@ -104,13 +104,15 @@
{{#js}}
// Initialise the JS.
require(['tool_lp/tree', 'tool_lp/competencytree', 'tool_lp/competencyactions' ], function(ariatree, treeModel, actions) {
require(['tool_lp/tree', 'tool_lp/competencytree', 'tool_lp/competencyactions', 'jquery'],
function(ariatree, treeModel, actions, $) {
treeModel.init({{framework.id}},
'{{framework.shortname}}',
'{{search}}',
'[data-enhance=tree]',
actions.selectionChanged);
'[data-enhance=tree]');
// Listen to the custom event triggered by the aria tree.
$('[data-enhance=tree]').on('change', actions.selectionChanged);
actions.init(treeModel, {{pagecontextid}}, {{{framework.taxonomies}}});