this.headless = this.options.hidden && !this.has_defaults;
this.input_subviews = [];
+ this.view_manager = null;
+ this.$view_manager_header = null;
this.ready = $.Deferred();
this.drawer_ready = $.Deferred();
var self = this;
var p = this._super();
+ this.$view_manager_header = this.$el.parents(".oe_view_manager_header").first();
+
this.setup_global_completion();
this.query = new my.SearchQuery()
.on('add change reset remove', this.proxy('do_search'))
.on('change', this.proxy('renderChangedFacets'))
- .on('add reset remove', this.proxy('renderFacets'));
+ .on('add reset remove', this.proxy('renderFacets'))
+ .on('add change reset remove', this.proxy('adjust_view_top'));
if (this.options.hidden) {
this.$el.hide();
}
if (view_manager) {
+ this.view_manager = view_manager;
view_manager.on('switch_mode', this, function (e) {
self.drawer.toggle(e === 'graph');
});
+ $(window).resize(this.proxy("adjust_view_top"));
}
- $(window).resize(this.adjust_top.bind(this));
- return $.when(p, this.ready).then(this.adjust_top.bind(this));
- },
-
- adjust_top: function () {
- // hack to adjust the top of the view manager body to the actual header height
- var parent = this.getParent();
- if (parent && parent.$) {
- var h = parent.$(".oe_view_manager_header").height() + 1;
- parent.$(".oe_view_manager_body").css('top', h + 'px');
- }
+ return $.when(p, this.ready);
},
set_drawer: function (drawer) {
});
},
+ // hack to adjust the top of the view body to the actual header height
+ // the best way would be to do that with pure css, but this cannot be done
+ // without giving up IE9 support (flexbox/grid) or without reworking the
+ // full client structure (switching from tables to a sane responsive layout with
+ // divs).
+ adjust_view_top: function () {
+ if (this.$view_manager_header.length) {
+ var height = this.$view_manager_header.height() + 1;
+ this.$view_manager_header.next().css('top', height + 'px');
+ }
+ },
+
search_view_loaded: function(data) {
var self = this;
this.fields_view = data;
// If no default view defined, switch to the first one in sequence
var default_view = this.flags.default_view || this.views_src[0].view_type;
-
return this.switch_mode(default_view, null, this.flags[default_view] && this.flags[default_view].options);
self.trigger("controller_inited",view_type,controller);
});
},
+
/**
* @returns {Number|Boolean} the view id of the given type, false if not found
*/
view_manager: self
}));
self.set_title();
+ self.searchview.adjust_view_top();
});
},
do_create_view: function(view_type) {