From 5adfc7654fb49e116e21bc8e8202d4a148be3780 Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Sun, 8 Mar 2015 12:16:22 +0200 Subject: client/filter: fix broken filter from recent model/types intro and third-internship-proposal removal --- src/client/view/graph_view.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/client/view/graph_view.js b/src/client/view/graph_view.js index 464c6756..98f15844 100644 --- a/src/client/view/graph_view.js +++ b/src/client/view/graph_view.js @@ -96,8 +96,7 @@ function GraphView(spec) { cx, cy, // FIXME take filter names from index.html or both from graph db - filter_states = _.object(_.map(model_types.nodetypes, function (type) { return [type, null]; })), - filter_state_names = model_types.nodetypes; + filter_states = _.object(_.map(model_types.nodetypes, function (type) { return [type, null]; })); util.assert(parent_element !== undefined && graph_name !== undefined && graph !== undefined && zoom_property !== undefined && @@ -120,16 +119,21 @@ function GraphView(spec) { update_window_size(); function read_checkboxes() { - var checkboxes = $('#menu__type-filter label input').map( - function (i, checkbox){ - return checkbox.checked; - } - ); + var name, + value, + // jquery map does flattens, and we don't want that + checkboxes = _.map($('#menu__type-filter label input'), + function (checkbox){ + return [checkbox.name, checkbox.checked]; + } + ); for (var i in checkboxes) { - if (filter_state_names[i] === undefined) { + name = checkboxes[i][0]; + value = checkboxes[i][1]; + if (undefined === filter_states[name]) { continue; } - filter_states[filter_state_names[i]] = checkboxes[i]; + filter_states[name] = value; } } -- cgit v1.3.1