From c0807b34b10d1d8fce8ed1554ba9dd62e933c9d4 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 30 May 2013 12:04:20 +0200 Subject: [PATCH] [IMP] export view: use events hash bzr revid: xmo@openerp.com-20130530100420-8zsa03ssom8ox2g4 --- addons/web/static/src/js/data_export.js | 35 ++++++++++++++----------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/addons/web/static/src/js/data_export.js b/addons/web/static/src/js/data_export.js index c7971371bef..fb5e391effd 100644 --- a/addons/web/static/src/js/data_export.js +++ b/addons/web/static/src/js/data_export.js @@ -4,6 +4,25 @@ var QWeb = instance.web.qweb, instance.web.DataExport = instance.web.Dialog.extend({ template: 'ExportTreeView', dialog_title: {toString: function () { return _t("Export Data"); }}, + events: { + 'click #add_field': function () { + var self = this; + this.$('#field-tree-structure tr.ui-selected') + .removeClass('ui-selected') + .find('a').each(function () { + var id = $(this).attr('id').split('-')[1]; + var string = $(this).attr('string'); + self.add_field(id, string); + }); + }, + 'click #remove_field': function () { + this.$('#fields_list option:selected').remove(); + }, + 'click #remove_all_field': function () { + this.$('#fields_list').empty(); + }, + 'click #export_new_list': 'on_show_save_list', + }, init: function(parent, dataset) { var self = this; var options = { @@ -23,22 +42,6 @@ instance.web.DataExport = instance.web.Dialog.extend({ var self = this; this._super.apply(this, arguments); self.$el.removeClass('ui-dialog-content ui-widget-content'); - self.$el.find('#add_field').click(function() { - self.$('#field-tree-structure tr.ui-selected') - .removeClass('ui-selected') - .find('a').each(function () { - var id = $(this).attr('id').split('-')[1]; - var string = $(this).attr('string'); - self.add_field(id, string); - }); - }); - self.$el.find('#remove_field').click(function() { - self.$el.find('#fields_list option:selected').remove(); - }); - self.$el.find('#remove_all_field').click(function() { - self.$el.find('#fields_list').empty(); - }); - this.$el.find('#export_new_list').click(this.on_show_save_list); var got_fields = new $.Deferred(); this.$el.find('#import_compat').change(function() {