0
我想self.drawer.toggle修改此行self.drawer.toggle(E === '圖')(E!== '形式') 「開始」 的這種方法 等級: 如何修改具有繼承類的類的方法?
instance.web.SearchView = instance.web.Widget.extend({
template: "SearchView",
start: function() {
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'));
if (this.options.hidden) {
this.$el.hide();
}
if (this.headless) {
this.ready.resolve();
} else {
var load_view = instance.web.fields_view_get({
model: this.dataset._model,
view_id: this.view_id,
view_type: 'search',
context: this.dataset.get_context(),
});
this.alive($.when(load_view)).then(function (r) {
self.fields_view_get.resolve(r);
return self.search_view_loaded(r);
}).fail(function() {
self.ready.reject.apply(null, arguments);
});
}
var view_manager = this.getParent();
while (!(view_manager instanceof instance.web.ViewManager) &&
view_manager && view_manager.getParent) {
view_manager = view_manager.getParent();
}
if (view_manager) {
this.view_manager = view_manager;
view_manager.on('switch_mode', this, function (e) {
self.drawer.toggle(e === 'graph');
});
}
return $.when(p, this.ready);
},
我是否可以覆蓋我的新課程中的所有行,或者有其他方法嗎?
完整的代碼在這個存儲庫https://github.com/odoo/odoo/blob/8.0/addons/web/static/src/js/search.js 行323到761是我想要的類修改和我想改變的唯一線是443 – erocre
看到更多的代碼將不會有所不同,但沒有它的概念仍然是一樣的。 –