'action_buttons': true,
},
view_type: 'tree',
+ events: {
+ 'click thead th.oe_sortable[data-id]': 'sort_by_column'
+ },
/**
* Core class for list-type displays.
*
'selected', [selection.ids, selection.records]);
});
- // Sorting columns
- this.$el.find('thead').delegate('th.oe_sortable[data-id]', 'click', function (e) {
- e.stopPropagation();
- var $this = $(this);
- self.dataset.sort($this.data('id'));
- if($this.hasClass("sortdown") || $this.hasClass("sortup")) {
- $this.toggleClass("sortdown").toggleClass("sortup");
- } else {
- $this.toggleClass("sortdown");
- }
- $this.siblings('.oe_sortable').removeClass("sortup sortdown");
-
- self.reload_content();
- });
-
// Add button
if (!this.$buttons) {
this.$buttons = $(QWeb.render("ListView.buttons", {'widget':self}));
}
this.trigger('list_view_loaded', data, this.grouped);
},
+ sort_by_column: function (e) {
+ e.stopPropagation();
+ var $column = $(e.currentTarget);
+ this.dataset.sort($column.data('id'));
+ if($column.hasClass("sortdown") || $column.hasClass("sortup")) {
+ $column.toggleClass("sortup sortdown");
+ } else {
+ $column.addClass("sortdown");
+ }
+ $column.siblings('.oe_sortable').removeClass("sortup sortdown");
+
+ this.reload_content();
+ },
/**
* Configures the ListView pager based on the provided dataset's information
*
}
this._super();
},
+ sort_by_column: function (e) {
+ e.stopPropagation();
+ if (!this.editor.is_editing()) {
+ this._super.apply(this, arguments);
+ }
+ },
/**
* Handles the activation of a record in editable mode (making a record
* editable), called *after* the record has become editable.