From 3e1f2e22f8c02e91ad40327ba8c27c271849fe5c Mon Sep 17 00:00:00 2001 From: MinRK Date: Mon, 3 Feb 2014 15:42:38 -0800 Subject: [PATCH] Make `SelectionWidget.values` a dict rename 'labels' and '_value' to 'value_names' and 'value_name'. To specify a mapping of value names and values, use a dict. If you specify `values=[list]`, then an OrderedDict will be used. Assignment after construction only supports a dict. --- .../notebook/js/widgets/widget_selection.js | 28 +++--- .../casperjs/test_cases/widgets_selection.js | 4 +- IPython/html/widgets/widget_selection.py | 92 +++++++++++-------- 3 files changed, 72 insertions(+), 52 deletions(-) diff --git a/IPython/html/static/notebook/js/widgets/widget_selection.js b/IPython/html/static/notebook/js/widgets/widget_selection.js index 5d9791c37..30c7ce426 100644 --- a/IPython/html/static/notebook/js/widgets/widget_selection.js +++ b/IPython/html/static/notebook/js/widgets/widget_selection.js @@ -57,14 +57,14 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){ // changed by another view or by a state update from the back-end. if (options === undefined || options.updated_view != this) { - var selected_item_text = this.model.get('_value'); + var selected_item_text = this.model.get('value_name'); if (selected_item_text.length === 0) { this.$droplabel.text(' '); } else { this.$droplabel.text(selected_item_text); } - var items = this.model.get('labels'); + var items = this.model.get('value_names'); var $replace_droplist = $('